java – Tomcat SSL:无法找到所请求目标的有效证书路径

我正在尝试访问我的应用程序中的URL,但我收到此错误.

1771426 [http-bio-8180-exec-15] ERROR gadget.GadgetValidatorServlet  - wsdl.exception.WSInvokerException: wsdl.exception.WSInvokerException: javax.xml.ws.soap.SOAPFaultException: 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
1771426 [http-bio-8180-exec-15] ERROR gadget.GadgetPortalValidatorServlet  - gadget.exception.GadgetValidatorException: wsdl.exception.WSInvokerException: wsdl.exception.WSInvokerException: javax.xml.ws.soap.SOAPFaultException: 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

我试图应用所有这些修复但没有成功:
http://www.mkyong.com/webservices/jax-ws/suncertpathbuilderexception-unable-to-find-valid-certification-path-to-requested-target/

不久,它需要运行InstallCert app(java InstallCert my.domain.com)并生成文件jssecacerts.之后我将这个文件复制并粘贴到/opt/java/jdk1.7.0_45/jre/lib/security/jssecacerts

我还导入我的证书,我的ssl url(httpd)中使用的证书也是我的tomcat使用的密钥库.

即使在那之后我仍然得到这个错误.

有什么想法吗?

最佳答案 通过在运行时将javax.net.ssl.trustStore系统属性设置为指向jssecacerts文件,我以前能够解决此问题.把它放在“正确”的地方从来没有对我有用;我必须明确地设置位置.无论如何这更便于携带,所以如果您的应用需要移动,我会推荐它.

System.setProperty("javax.net.ssl.trustStore", "/path/to/jssecacerts");
点赞