【问题标题】:"PKIX path building failed:" "unable to find valid certification path to requested target" for remote server远程服务器的“PKIX 路径构建失败:”“无法找到到所请求目标的有效证书路径”
【发布时间】:2021-02-22 21:56:27
【问题描述】:

我的 tomcat catalina.out 日志中出现此错误:

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

尝试访问此远程 URL 时:https://remote-hostname-fqdn-here:8443。当在本地进行相同的调用时,这可以正常工作。

我已将证书导入密钥库,即当我使用 keytool 列出证书内容时看到以下内容:

$ /opt/jdk1.7.0_75/bin/keytool -list -v -keystore /opt/apache-tomcat/conf/ssl/cacerts | grep icr

Alias name: remote-hostname-fqdn-here
Creation date: Jan 4, 2018
Entry type: trustedCertEntry

Owner: CN=remote-hostname-fqdn-here, O="Org-name-removed", L=Place-removed, ST=State-removed, C=US
Issuer: CN=remote-hostname-fqdn-here, O="Org-name-removed", L=Place-removed, ST=State-removed, C=US
Serial number: serial-number-removed 
Valid from: Thu Jan 04 13:22:32 CST 2018 until: Sun Jan 02 13:22:32 CST 2028
Certificate fingerprints:
         MD5:  md5sum-value-removed 
         SHA1: sha1-value-removed 
         SHA256: sha256-value-removed 
         Signature algorithm name: SHA1withRSA
         Version: 1

请注意,我在两个环境中都有 tomcat 实例,都运行 Java jdk1.7.0_75 和 Tomcat 7.0.90,以及相同的 SSL 连接器配置。奇怪的是,这个错误只发生在其中一个上,即使我们尝试了相同的操作来清除应用程序缓存以触发两者上的错误。

虽然我确实在所有服务器上的 server.xml 中配置了通配符证书(与此处提到的证书不同),但我认为我必须将该证书导入密钥库是合乎逻辑的。但是,我没有在任何一个环境中导入它,所以我不知道为什么我只在一个环境中得到这个错误。请注意,除了清除远程服务器的应用程序缓存这一功能之外,SSL 的所有其他方面似乎都运行良好。

【问题讨论】:

    标签: ssl tomcat


    【解决方案1】:

    为每台服务器导入覆盖与当前域相同域的通配符证书解决了该问题。仍然不知道为什么我无法在其他环境中重现问题。虽然 .war 和 .jar 文件不同,但有人告诉我这里问题的代码部分是相同的。

    【讨论】:

      猜你喜欢
      • 2011-05-03
      • 2020-03-25
      • 2013-02-03
      • 2018-07-15
      • 2014-01-31
      相关资源
      最近更新 更多