Mybatis-Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of th

Posted daopinz

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mybatis-Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of th相关的知识,希望对你有一定的参考价值。

    一开始没有配置SSL的选项,日志中有个WARN警告:

Wed Aug 04 10:10:55 CST 2021 WARN: Establishing SSL connection without server's identity verification is not recommended. 
According to mysql 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. 
For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. 
You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

    按照提示添加上了SSL的配置useSSL=true,啪~来了一堆没有见过的异常。。。

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(Alerts.java:192)
	at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1946)
	at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:316)
	at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:310)
	at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1640)
	at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:223)
	at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1037)
	at sun.security.ssl.Handshaker.process_record(Handshaker.java:965)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
	at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:187)
	... 125 more
Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
	at com.mysql.jdbc.ExportControlled$X509TrustManagerWrapper.checkServerTrusted(ExportControlled.java:303)
	at sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:1099)
	at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1622)
	... 133 more
Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
	at sun.security.provider.certpath.PKIXCertPathValidator.validate(PKIXCertPathValidator.java:159)
	at sun.security.provider.certpath.PKIXCertPathValidator.engineValidate(PKIXCertPathValidator.java:85)
	at java.security.cert.CertPathValidator.validate(CertPathValidator.java:292)
	at com.mysql.jdbc.ExportControlled$X509TrustManagerWrapper.checkServerTrusted(ExportControlled.java:296)
	... 135 more

    其实非常简单,只需要将useSSL=true  修改为:useSSL=false即可

=========================================================================

记录一下------20210804

以上是关于Mybatis-Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of th的主要内容,如果未能解决你的问题,请参考以下文章

Mybatis-Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of th

Mybatis-Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of th

查询方法 find...By、read...By、query...By 和 get...By 在 spring 数据中有啥区别?

hive order by sort by distribute by和sort by一起使用 cluster by

Hive之cluster by , distribute by,order by,sort by

Hive中order by,sort by,distribute by,cluster by的区别