Getting error: PKIX path building failed: unable to find valid certification path to requested target(出现错误:PKIX 路径构建失败:无法找到请求目标的有效证书路径)
问题描述
我正在尝试通过 Web 服务将 xml 发送到另一个系统.但是在尝试发送时,我收到以下错误.我已经安装了他们给我的证书.但它仍然无法正常工作.
I'm trying to send a xml to another system via web service. But while trying to send i'm getting the following error. I've installed the certificate they gave to me. but still its not working.
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
推荐答案
这个错误有两种可能的来源:
There are two possible sources for this error:
- 对方正在使用真正不受信任的证书(自签名或由不受信任的 CA 签名),
- 或对方未发送证书验证链(例如,在通往您信任的 CA 的过程中存在中间签名证书,但 SSL 握手中不存在此证书).
第一种情况的解决方案是将不受信任的 CA(或证书本身)添加到您的 JRE 信任库 (${java.home}/lib/security/cacerts
) 或更好 - 创建您的自己的信任库(升级 Java 时不会被删除)并通过 javax.net.ssl.trustStore
JVM 属性.
Solution for the first case is to add the untrusted CA (or the ceriticate itself) to your JRE truststore (${java.home}/lib/security/cacerts
) or better - create your own truststore (which will not get removed when upgrading Java) and provide that to your application via javax.net.ssl.trustStore
JVM property.
第二种情况的解决方案是采用第一种情况的解决方案或更好 - 说服对方发送正确的证书链.
Solution for the second case is either to go with the first case solution or better - convince the opposite side to send correct certificate chain.
这篇关于出现错误:PKIX 路径构建失败:无法找到请求目标的有效证书路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:出现错误:PKIX 路径构建失败:无法找到请求目标的有效证书路径


基础教程推荐
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- 大摇大摆的枚举 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- 从 python 访问 JVM 2022-01-01
- 多个组件的复杂布局 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01