2012-10-25 96 views
1

我們在嘗試連接服務器時遇到此java SSL錯誤。在運行應用程序時,我們得到這個錯誤,然後我們必須重新啓動應用程序才能再次使用。任何人都可以幫忙嗎?SSLHandshakeException:收到致命警報:handshake_failure

at java.lang.Thread.run(Thread.java:662) 
Caused by: com.sun.xml.internal.ws.wsdl.parser.InaccessibleWSDLException: 2 counts of InaccessibleWSDLException. 
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:161) 
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:133) 
at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:254) 
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:217) 
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:165) 
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:93) 
at javax.xml.ws.Service.<init>(Service.java:56) 
+0

請運行帶有-Djavax.net.debug = SSL,握手您的代碼和發佈所產生的密鑰庫在這裏輸出。 – EJP

+0

謝謝EJP。我們在生產服務器上有時會出現此錯誤,並且在重新啓動後再次正常工作。本地它工作正常,但我想重現它,所以我會提供一次,我在當地得到它 – Raman

回答

0

here拿起,因爲我面臨類似的問題。

當您嘗試連接的服務器沒有來自授權CA的有效證書時,通常會拋出javax.net.ssl.SSLHandshakeException異常。

簡而言之,您嘗試連接的服務器很可能使用了自簽名證書,並且您必須在Java代碼中容納該證書。這涉及到創建自定義KeyStore等。

我所做的只是向服務器提供密鑰庫和密鑰庫密碼(將其設置在系統屬性中),並且異常消失。

javax.net.ssl.keyStore=../keystore/keystoreFile.jks 
javax.net.ssl.keyStorePassword=yourPassword 
javax.net.ssl.trustStore=../keystore/keystoreFile.jks 
javax.net.ssl.trustStorePassword=yourPassword 
javax.net.debug=true 

您可以生成通過使用密鑰工具(它是JDK /斌/密鑰工具)

keytool -genkey -alias myKeyStore -keyalg RSA -keystore /home/aniket/keystore/keystoreFile.jks 
相關問題