1. 程式人生 > >【java】【MySql】Path does not chain with any of the trust anchors

【java】【MySql】Path does not chain with any of the trust anchors

在客戶現場安裝應用時,應用啟動失敗,錯誤如下:

 1 2018-12-12 20:17:44.371 |-ERROR [Druid-ConnectionPool-Create-116919541] com.alibaba.druid.pool.DruidDataSource [2471] -| create connection SQLException, url: jdbc:mysql://127.0.0.1:3306/xx?characterEncoding=utf8&useSSL=true, errorCode 0, state 08S01
 2 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
3 4 The last packet successfully received from the server was 905 milliseconds ago. The last packet sent successfully to the server was 899 milliseconds ago. 5 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 6 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
7 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 8 at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 9 at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) 10 at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990)
11 at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:201) 12 at com.mysql.jdbc.MysqlIO.negotiateSSLConnection(MysqlIO.java:4912) 13 at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1663) 14 at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1224) 15 at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2190) 16 at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2221) 17 at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2016) 18 at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:776) 19 at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) 20 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 21 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 22 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 23 at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 24 at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) 25 at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:386) 26 at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330) 27 at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:156) 28 at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:218) 29 at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150) 30 at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1560) 31 at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1623) 32 at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2468) 33 Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors 34 at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) 35 at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1959) 36 at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:328) 37 at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:322) 38 at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1614) 39 at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216) 40 at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1052) 41 at sun.security.ssl.Handshaker.process_record(Handshaker.java:987) 42 at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072) 43 at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385) 44 at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413) 45 at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397) 46 at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:186) 47 ... 21 common frames omitted 48 Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors 49 at com.mysql.jdbc.ExportControlled$X509TrustManagerWrapper.checkServerTrusted(ExportControlled.java:302) 50 at sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:985) 51 at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1596) 52 ... 29 common frames omitted 53 Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors 54 at sun.security.provider.certpath.PKIXCertPathValidator.validate(PKIXCertPathValidator.java:153) 55 at sun.security.provider.certpath.PKIXCertPathValidator.engineValidate(PKIXCertPathValidator.java:79) 56 at java.security.cert.CertPathValidator.validate(CertPathValidator.java:292) 57 at com.mysql.jdbc.ExportControlled$X509TrustManagerWrapper.checkServerTrusted(ExportControlled.java:295) 58 ... 31 common frames omitted

在網上搜索是,證書的問題,地址中的useSSL改為false即可。

後再windows中安裝5.7資料庫,沒有報錯。