这个问题有点棘手。我尝试通过 LDAPS 将我的 war 文件连接到 Active Directory。在 IntelliJ IDEA 中使用 Debug模式运行时,代码运行得非常好。
当我在同一台或不同机器上安装 war 文件时,遇到此错误。
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
证书是自签名的。我已在 truststore.jks
中添加了 CA.crt,在 cacerts
中添加了 LDAP.cer。我也尝试添加“jssecacerts”,但结果相同。
注意:我使用 Apache Shiro 框架。
如何避免这个错误?为什么它没有进入 Debug模式?
最佳答案
这不是 Shiro 的问题。是你的证书有问题。我怀疑您的 IDE 可能使用与您部署的 WAR 执行位置不同的 Java 安装。
此异常之前已处理过 How to ignore PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException? 。
此外,我发现这篇文章很有用 PKIX path building failed: SunCertPathBuilderException: unable to find valid certification path to requested target. .
关于java - "PKIX path building failed: unable to find valid certification path to requested target"仅在发布版本中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35133863/