Details
-
New Feature
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Not a Bug
-
3.3.3
-
None
Description
The exception information of the MariaDB Connector is not sufficient and should show more reasons of connection failures.
Example: When the DB server has an expired SSL certificate, this exception message is shown:
Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
Only DEBUG logging indicates the actual cause:
Caused by: javax.net.ssl.SSLHandshakeException: NotAfter: Sat Jan 13 17:21:58 CET 2024
#011at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
#011at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:360)
#011at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:303)
#011at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:298)
#011at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1357)
#011at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(CertificateMessage.java:1232)
#011at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(CertificateMessage.java:1175)
#011at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392)
#011at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:443)
#011at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:421)
#011at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:183)
#011at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:172)
#011at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1511)
#011at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1421)
#011at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:456)
#011at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:427)
#011at com.mysql.cj.protocol.ExportControlled.performTlsHandshake(ExportControlled.java:214)
#011at com.mysql.cj.protocol.StandardSocketFactory.performTlsHandshake(StandardSocketFactory.java:191)
#011at com.mysql.cj.protocol.a.NativeSocketConnection.performTlsHandshake(NativeSocketConnection.java:101)
#011at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:370)
#011... 100 common frames omitted
Caused by: java.security.cert.CertificateExpiredException: NotAfter: Sat Jan 13 17:21:58 CET 2024
#011at java.base/sun.security.x509.CertificateValidity.valid(CertificateValidity.java:277)
#011at java.base/sun.security.x509.X509CertImpl.checkValidity(X509CertImpl.java:669)
#011at java.base/sun.security.x509.X509CertImpl.checkValidity(X509CertImpl.java:642)
#011at com.mysql.cj.protocol.ExportControlled$X509TrustManagerWrapper.checkServerTrusted(ExportControlled.java:680)
#011at java.base/sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:1533)
#011at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1341)
#011... 115 common frames omitted
The thrown exception message should be more elaborate for known/common issues.
For end users to identify that the connection failed because of a outdated SSL certificate is a bit hard.