Path does not chain with any of the trust anchors
生活随笔
收集整理的這篇文章主要介紹了
Path does not chain with any of the trust anchors
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
報錯信息
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 anchorsat 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 anchorsat 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 anchorsat 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解決
不建議在沒有服務(wù)器身份驗(yàn)證的情況下建立SSL連接。根據(jù)MySQL 5.5.45+、5.6.26+和5.7.6+的要求,
如果不設(shè)置顯式選項(xiàng),則必須建立默認(rèn)的SSL連接。需要通過設(shè)置useSSL=false來顯式禁用SSL,
或者設(shè)置useSSL=true并為服務(wù)器證書驗(yàn)證提供信任存儲。
找到數(shù)據(jù)連接的url,這里是ssm整合時的配置文件中
將useSSL=true改為useSSL=false
<!-- 定義數(shù)據(jù)源Bean --><!-- Druid --><bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"><property name="url"value="jdbc:mysql://localhost:3306/ssmtest?characterEncoding=UTF-8&useSSL=false" /><property name="username" value="root" /><property name="password" value="123" /></bean>?
總結(jié)
以上是生活随笔為你收集整理的Path does not chain with any of the trust anchors的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 对实体 useSSL 的引用必须以 ';
- 下一篇: SSM整合时Maven项目的pom.xm