This question already has answers here:
“PKIX path building failed” and “unable to find valid certification path to requested target”

(33个答案)


4个月前关闭。





我正在尝试让示例在官方的Spring Boot文档中运行:
https://spring.io/guides/gs/spring-boot/#initial

我CD到我的gitprojects文件夹并执行

$ git clone https://github.com/spring-guides/gs-spring-boot.git



克隆到“ gs-spring-boot” ...远程:枚举对象:1348,
完成。远程:总计1348(增量0),已重用0(增量0),已重新打包
1348接收物体:100%(1348/1348),776.07 KiB | 3.48 MiB /秒,
完成。解析增量:100%(894/894),已完成。


然后我

cd gs-spring-boot/complete


然后我

$ ./gradlew bootRun



正在下载
https://services.gradle.org/distributions/gradle-5.6.3-bin.zip

线程“主”中的异常javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException:PKIX路径构建失败:
sun.security.provider.certpath.SunCertPathBuilderException:无法执行
查找到请求目标的有效认证路径


如果最简单的官方示例不起作用,我们如何才能使真正的(困难的)示例起作用?

最佳答案

jvm使用它的信任库来检查主机是否受信任。 jvm信任库位于$ JAVA_HOME / jre / lib / security / cacerts中。您可以列出其中的根证书

keytool -list -v -keystore $JAVA_HOME/jre/lib/security/cacerts


提示您输入密码后,输入changeit
gradle分发页面https://services.gradle.org/distributions/
具有根CA Baltimore CyberTrust Root,您可以使用浏览器进行检查。因此,您必须检查此证书是否位于jvm信任库中。如果不是,那么您必须更新您的JVM或将此证书添加到现有JVM的信任库中。其他信息:keytool

10-04 23:17
查看更多