简体   繁体   English

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

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

I have an interesting problem I have yet to find a solution for.我有一个有趣的问题,我还没有找到解决方案。 I have a Spring Boot application that is attempting to connect to a 3rd party API. When I run this application locally using the embedded Tomcat server, attempts to connect to this 3rd party API fail with the following exception:我有一个 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

I've imported the certificate for my 3rd party API into my local JDK's keystore and if I run this application on another application server like Weblogic then it executes as expected.我已经将我的第 3 方 API 的证书导入到本地 JDK 的密钥库中,如果我在另一个应用程序服务器(如 Weblogic)上运行此应用程序,那么它会按预期执行。 I just can't seem to get the Spring Boot embedded Tomcat server to behave properly.我似乎无法让 Spring Boot embedded Tomcat 服务器正常运行。

Any advice would be appreciated.任何意见,将不胜感激。

Turns out my issue was a missing 3rd level intermediate certificate that I need to get through my corporate firewall.原来我的问题是缺少 3 级中间证书,我需要通过我的公司防火墙。 In order to figure this out I enabled SSL debugging so I could find the missing certificate.为了解决这个问题,我启用了 SSL 调试,这样我就可以找到丢失的证书。 I accomplished this by adding the following VM argument to my application:我通过将以下 VM 参数添加到我的应用程序来完成此操作:

-Djavax.net.debug=SSL

Once I saw there was a 3rd level certificate, I imported that certificate into my JDK and poof ...problem solved.一旦我看到有一个 3 级证书,我将该证书导入到我的 JDK 中,……问题解决了。

Maybe check that your java_home and Java.exe in your path point to the same installation.也许检查您路径中的 java_home 和 Java.exe 是否指向同一安装。 Usually we have multiple jres and a lot of the time certs get installed into a different jre then being run.通常我们有多个 jres,很多时候证书会安装到不同的 jre 中然后运行。 Maybe inspect the process and make sure it's using the same jre as has the certs (maybe even try jconsole to verify)也许检查过程并确保它使用与证书相同的 jre(甚至可以尝试 jconsole 来验证)

暂无
暂无

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

相关问题 Java Spring Boot Starter-thymeleaf-无法找到请求目标的有效证书路径 - Java spring boot starter-thymeleaf - unable to find valid certification path to requested target Tomcat SSL:无法找到所请求目标的有效认证路径 - Tomcat SSL: unable to find valid certification path to requested target HTTP传输错误:无法在tomcat上找到请求的有效证书路径 - HTTP transport error: unable to find valid certification path to requested on tomcat 无法找到有效的证书路径 - unable to find valid certification path 无法找到到请求目标的有效证书路径 - unable to find a valid certification path to requested target 构建失败-无法找到有效的认证路径 - Build failed - unable to find valid certification path Spring LDAP TLS / SSL异常:PKIX路径构建失败:无法找到到请求目标的有效证书路径 - Spring LDAP TLS / SSL Exception: PKIX path building failed: unable to find valid certification path to requested target 无法在 spring rest 模板客户端中找到请求目标的有效认证路径 - Unable to find valid certification path to requested target in spring rest template client Spring 工具套件 - SunCertPathBuilderException:无法找到请求目标的有效证书路径 - Spring tool suite- SunCertPathBuilderException: unable to find valid certification path to requested target 需要帮助运行带有证书文件的 Spring restTemplate - 无法找到请求目标的有效证书路径 - Need help running Spring restTemplate with cert files - unable to find valid certification path to requested target
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM