Java Eclipse 中的 PKIX 路径构建失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38844061/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PKIX path building failed in Eclipse
提问by El0din
i'm working with Liferay and i'm using eclipse, and running a client/server model, using an encrypted socket (SSL).
我正在使用 Liferay,我正在使用 eclipse,并使用加密套接字 (SSL) 运行客户端/服务器模型。
Currently, my application is running the client/server connection ok when I run the application in batch mode but when i try to start the server in Eclipse the application is giving me error
目前,当我以批处理模式运行应用程序时,我的应用程序正在运行客户端/服务器连接,但是当我尝试在 Eclipse 中启动服务器时,应用程序给我错误
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
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
I already use the InstallCert.java and copy the jssecacerts into
我已经使用 InstallCert.java 并将 jssecacerts 复制到
%JAVA_HOME%/jdk_version/jre/lib/security
%JAVA_HOME%/jdk_version/jre/lib/security
but is still giving me errors. I've also checked the certificate (keytool -v -list) and installed manually in the root CAs trusted. What can be the problem? Thanks!
但仍然给我错误。我还检查了证书 (keytool -v -list) 并在受信任的根 CA 中手动安装。可能是什么问题?谢谢!
回答by KLajdPaja
Try passing the certifacate path in VM arguments when running in eclipse
在 eclipse 中运行时,尝试在 VM 参数中传递证书路径
-Djavax.net.ssl.trustStore="PATH_TO_jssecacerts"
回答by positivecrux
Please refer thisanswer for your reference.
请参考此答案以供参考。
No need of passing any VM arguments after you successfully installed certificate of the site which is giving you PKIX error!
成功安装站点证书后,无需传递任何 VM 参数,这会导致 PKIX 错误!
But key is to find JRE which is giving you this error! So make sure about 2 things:
但关键是找到给你这个错误的 JRE!因此,请确保两件事:
- you install certificate to
cacerts
file of JRE which Eclipse is using - certificate is root certificate
- 您将证书安装到
cacerts
Eclipse 正在使用的 JRE 文件中 - 证书是根证书