繁体   English   中英

Spring Boot Embedded Tomcat - 无法找到有效的证书路径

[英]Spring Boot Embedded Tomcat - Unable to find valid certification path

我有一个有趣的问题,我还没有找到解决方案。 我有一个 Spring 引导应用程序正在尝试连接到第三方 API。当我使用嵌入式 Tomcat 服务器在本地运行此应用程序时,尝试连接到该第三方 API 失败,出现以下异常:

org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://<third party API endpoint>": sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; 
nested exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

我已经将我的第 3 方 API 的证书导入到本地 JDK 的密钥库中,如果我在另一个应用程序服务器(如 Weblogic)上运行此应用程序,那么它会按预期执行。 我似乎无法让 Spring Boot embedded Tomcat 服务器正常运行。

任何意见,将不胜感激。

原来我的问题是缺少 3 级中间证书,我需要通过我的公司防火墙。 为了解决这个问题,我启用了 SSL 调试,这样我就可以找到丢失的证书。 我通过将以下 VM 参数添加到我的应用程序来完成此操作:

-Djavax.net.debug=SSL

一旦我看到有一个 3 级证书,我将该证书导入到我的 JDK 中,……问题解决了。

也许检查您路径中的 java_home 和 Java.exe 是否指向同一安装。 通常我们有多个 jres,很多时候证书会安装到不同的 jre 中然后运行。 也许检查过程并确保它使用与证书相同的 jre(甚至可以尝试 jconsole 来验证)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM