Path does not chain with any of the trust anchors

报错信息

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
 at sun.reflect.GeneratedConstructorAccessor34.newInstance(Unknown Source)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
 at java.lang.reflect.Constructor.newInstance(Unknown Source)
 at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:59)
 at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:103)
 at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:149)
 at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:165)
 at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:355)
 at com.mysql.cj.protocol.a.NativeAuthenticationProvider.negotiateSSLConnection(NativeAuthenticationProvider.java:789)
 at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:499)
 at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:217)
 at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1411)
 at com.mysql.cj.NativeSession.connect(NativeSession.java:165)
 at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:982)
 at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:852)
 ... 6 more
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
 at sun.security.ssl.Alerts.getSSLException(Unknown Source)
 at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
 at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
 at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
 at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
 at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
 at sun.security.ssl.Handshaker.processLoop(Unknown Source)
 at sun.security.ssl.Handshaker.process_record(Unknown Source)
 at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
 at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
 at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
 at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
 at com.mysql.cj.protocol.ExportControlled.performTlsHandshake(ExportControlled.java:213)
 at com.mysql.cj.protocol.StandardSocketFactory.performTlsHandshake(StandardSocketFactory.java:206)
 at com.mysql.cj.protocol.a.NativeSocketConnection.performTlsHandshake(NativeSocketConnection.java:99)
 at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:350)
 ... 13 more
Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
 at com.mysql.cj.protocol.ExportControlled$X509TrustManagerWrapper.checkServerTrusted(ExportControlled.java:280)
 at sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(Unknown Source)
 ... 25 more
Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
 at sun.security.provider.certpath.PKIXCertPathValidator.validate(Unknown Source)
 at sun.security.provider.certpath.PKIXCertPathValidator.engineValidate(Unknown Source)
 at java.security.cert.CertPathValidator.validate(Unknown Source)
 at com.mysql.cj.protocol.ExportControlled$X509TrustManagerWrapper.checkServerTrusted(ExportControlled.java:273)
 ... 26 more

解决

不建议在没有服务器身份验证的情况下建立SSL连接。根据MySQL 5.5.45+、5.6.26+和5.7.6+的要求,

如果不设置显式选项,则必须建立默认的SSL连接。需要通过设置useSSL=false来显式禁用SSL,

或者设置useSSL=true并为服务器证书验证提供信任存储。

找到数据连接的url,这里是ssm整合时的配置文件中

将useSSL=true改为useSSL=false


    
    
       
        
        
    

 

你可能感兴趣的:(数据库)