0

We are getting this java SSL error while trying to connect server. In running application we are getting this error and then we have to restart the application to make workable again. Can anyone help on this?

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) 
Jonathan
  • 20,053
  • 6
  • 63
  • 70
Raman
  • 9
  • 1
  • 3
  • Please run your code with -Djavax.net.debug=ssl,handshake and post the resulting output here. – user207421 Oct 26 '12 at 02:32
  • Thanks EJP. We are getting this error on production server sometimes and after restarting it again work fine. Locally it is working fine but I am trying to reproduce it so i will provide once i got it locally – Raman Oct 26 '12 at 05:39

1 Answers1

-1

Picked up from here as i faced similar problem.

The javax.net.ssl.SSLHandshakeException exception is usually thrown when the server you're trying to connect to does not have a valid certificate from an authorized CA.

Put simply, the server you're attempting to connect to is most likely using a self-signed certificate and you have to accomodate for that in your Java code. This involves creating a custom KeyStore, etc.

All i did was provide keystore and keystore password to server(set it in system properties) and the exception disappeared.

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

you can generate the keystore by using keytool(it is in jdk/bin/keytool)

keytool -genkey -alias myKeyStore -keyalg RSA -keystore /home/aniket/keystore/keystoreFile.jks
Community
  • 1
  • 1
Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289
  • There are about 11 reasons for handshake failures. You should never use the same file for both both keystore and truststore. – user207421 Mar 17 '19 at 00:55