PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径?

PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target?

我使用 java 使用 keytool 创建了一个本地密钥库,并在 Apache Tomcat 中完成了 ssl 配置。

我已经在本地机器上安装了证书,甚至作为可信条目添加到 jre cacerts。

通过 https 通过浏览器打开工作正常

但问题出在尝试通过目录服务进行访问时。

error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

最后,我找到了正确的 JRE 并将证书添加为可信条目,从而解决了问题。

Working with browser is fine since the browser knows that the certificate is trusted but JRE is dumb in this case. So, need to add the certificate as trusted entry to the cacerts keystore of the correct JRE(When we have multiple JREs installed on our system).