简体   繁体   English

sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求的目标错误的有效证书路径

[英]sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target error

Where I run the below code I get the error: 在运行以下代码的地方出现错误:

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

I have tried to add the Certificate to the CAcerts keystore for the JDK but with no change in the error. 我试图将证书添加到JDK的CAcerts密钥库中,但是错误没有任何变化。 Is their anyway to figure out what keystore it is reading from? 他们是否仍然想知道它正在读取什么密钥库? Or is this problem something else? 还是这个问题?

public static void main(String args[]) throws Exception {

        SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
        SOAPConnection soapConnection = soapConnectionFactory.createConnection();


        String url = "https://www.mywebservice.com/ws";


    SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(),url);



        // print SOAP Response
        System.out.print("Response SOAP Message:");
        soapResponse.writeTo(System.out);

        soapConnection.close();


    }

Thank you and I will happily provide any other details required. 谢谢,我们很乐意提供所需的其他详细信息。

You have to add the server certificate, or the root CA to the truststore used by JDK. 您必须将服务器证书或根CA添加到JDK使用的信任库中。 By default is used jre/lib/security/cacerts . 默认情况下使用jre/lib/security/cacerts

If you already imported the server certificate, then verify that you are actually using the correct JDK, or the certificate is successfully imported. 如果您已经导入了服务器证书,请验证您实际上是否使用了正确的JDK,或者证书已成功导入。 You can use a GUI tool like http://www.keystore-explorer.org/ or use keytool 您可以使用http://www.keystore-explorer.org/等GUI工具,也可以使用keytool

You can also use your own trustore (recommended) using a JKS file which includes the server certificate. 您还可以使用包含服务器证书的JKS文件使用自己的托管人(推荐)。 Configure the usage in this way 通过这种方式配置用法

System.setProperty ("javax.net.ssl.trustStore", path_to_your_trustore_jks_file);
System.setProperty ("javax.net.ssl.trustStorePassword", "password");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 GCP-PUBSUB:-sun.security.provider.certpath.SunCertPathBuilderException: 无法找到请求目标的有效认证路径 - GCP-PUBSUB:-sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 引起:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径 - Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target PKIX 构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径 - PKIX building failed:sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Java:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效认证路径 - Java: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 使用 xmpp 时出现错误“sun.security.provider.certpath.SunCertPathBuilderException:无法找到到所请求目标的有效证书路径” - Error ' sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target' when using xmpp PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到到请求目标的有效认证路径? - PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target? CXF:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径 - CXF:PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到到请求目标的有效认证路径 - PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 无法找到到请求的目标PKIX路径构建的有效证书路径失败:sun.security.provider.certpath.SunCertPathBuilderException - unable to find valid certification path to requested target PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException 看到SSLFactory使用的密钥库了吗? 异常:“ sun…certpath.SunCertPathBuilderException:无法找到到请求目标的有效证书路径” - See keystore used by SSLFactory? Exception: “sun…certpath.SunCertPathBuilderException: unable to find valid certification path to requested target”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM