我收到了非常流行的「SSLHandShakeException」。Javax.new.ssl.SSLHandShakeException分辨率
我正在運行一個使用IntelliJ的java客戶端,該客戶端用於處理Web服務請求/響應。我們通過一組憑據和一個url連接到服務器,並傳入一個請求文件。
我所做的
驗證網址正在構建在瀏覽器中的作品。
添加使用這些 指令的證書信任存儲區,Keytool Instructions
驗證正確的JRE是正在使用的信任。
我正在使用一個httpClient對象。我實例化對象如下,
private void initConnection() { CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials(new AuthScope(this.target.getHostName(), this.target.getPort()), new UsernamePasswordCredentials(this.userid, this.password)); this.httpClient = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build(); // Be able to deal with basic auth. Generate BASIC scheme object and // add it to the local auth cache BasicScheme basicScheme = new BasicScheme(); // we throw an error here this.authCache.put(this.target, basicScheme); localContext = HttpClientContext.create(); localContext.setAuthCache(this.authCache); }
的執行用於此目的是如下這也是引發錯誤的代碼,
responseNode = this.httpClient.execute(getTarget(), httpRequest, responseHandler);
我已嘗試強制信任存儲過程如下,
System.setProperty(「javax.net.ssl.trustStore」,「.... Common \ JRE \ lib \ security \ cacerts」); System.setProperty(「javax.net.ssl.trustStorePassword」,「changeit」);
當SSL沒有涉及時,對http很有效。
其他然後,我沒有使用SSL的專家。我已經進行了相當多的挖掘,我希望有人有一個想法。我當然願意沒有正確安裝證書(十幾次),或者可能需要添加一些代碼來正確配置我的對象。如果缺少信息,我會很樂意提供!
非常感謝。
您可能需要更新到你的''路徑'通過逃避轉義字符cacerts'''。你設置好後是否嘗試過打印''java.net.ssl.trustStore'''的值? –
的字符轉義,在#1能幫助和刪除它們。我不能說我已經打印了價值。讓我一起去。理想情況下,我不想包括第6點。它的工作。 –
請張貼整個消息和堆棧貿易,並修復意義的稱號。 – EJP