簡體   English   中英

sun.security.provider.certpath.SunCertPathBuilderException:無法找到請求的目標錯誤的有效證書路徑

[英]sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 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

我試圖將證書添加到JDK的CAcerts密鑰庫中,但是錯誤沒有任何變化。 他們是否仍然想知道它正在讀取什么密鑰庫? 還是這個問題?

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();


    }

謝謝,我們很樂意提供所需的其他詳細信息。

您必須將服務器證書或根CA添加到JDK使用的信任庫中。 默認情況下使用jre/lib/security/cacerts

如果您已經導入了服務器證書,請驗證您實際上是否使用了正確的JDK,或者證書已成功導入。 您可以使用http://www.keystore-explorer.org/等GUI工具,也可以使用keytool

您還可以使用包含服務器證書的JKS文件使用自己的托管人(推薦)。 通過這種方式配置用法

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: 無法找到請求目標的有效認證路徑 引起:sun.security.provider.certpath.SunCertPathBuilderException:無法找到請求目標的有效證書路徑 PKIX 構建失敗:sun.security.provider.certpath.SunCertPathBuilderException:無法找到請求目標的有效證書路徑 Java:sun.security.provider.certpath.SunCertPathBuilderException:無法找到請求目標的有效認證路徑 使用 xmpp 時出現錯誤“sun.security.provider.certpath.SunCertPathBuilderException:無法找到到所請求目標的有效證書路徑” PKIX路徑構建失敗:sun.security.provider.certpath.SunCertPathBuilderException:無法找到到請求目標的有效認證路徑? CXF:PKIX 路徑構建失敗:sun.security.provider.certpath.SunCertPathBuilderException:無法找到請求目標的有效證書路徑 PKIX路徑構建失敗:sun.security.provider.certpath.SunCertPathBuilderException:無法找到到請求目標的有效認證路徑 無法找到到請求的目標PKIX路徑構建的有效證書路徑失敗:sun.security.provider.certpath.SunCertPathBuilderException 看到SSLFactory使用的密鑰庫了嗎? 異常:“ sun…certpath.SunCertPathBuilderException:無法找到到請求目標的有效證書路徑”
 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM