我有一个在 Eclipse 中运行的应用程序,运行良好,连接并从需要证书的 Web 服务获得响应。 但是当我在Tomcat中部署运行时,出现valid certification的错误:
java.lang.Exception
Message
; nested exception is: 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
在我的 tomcat 中:
<Connector SSLEnabled="true" acceptCount="100" clientAuth="false"
disableUploadTimeout="true" enableLookups="false" maxThreads="25"
port="8443" keystoreFile="webapps/.keystore" keystorePass="123456"
protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https"
secure="true" sslProtocol="TLS" />
在我的应用程序中,我有另一个 web 服务的 keystore :
System.setProperty("javax.net.ssl.keyStore", SIC.jks);
System.setProperty("javax.net.ssl.keyStore", keyStore);
System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword);
System.setProperty("javax.net.ssl.trustStore", trustStore);
System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
我尝试从 keytool 将证书导入到 cacerts,但没有...
我没有任何想法,我的工作时间结束了......我该怎么做才能解决这个问题?
我尝试了我猜想的一切......在 Eclipse 上工作,但在部署 tomcat 时,我遇到了上面的错误。
最佳答案
两个建议
1. 指定keystoreFile 的完整路径。例如
/opt/webapps/.keystore2、密码中不要使用特殊字符“@”。
关于java - Keystore 证书适用于 Eclipse 但 Tomcat 不行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24706154/