5 Replies Latest reply: Feb 17, 2011 10:09 AM by 837869 RSS

    javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failur

    837869
      Hi, I have a requirement where I have to do following steps :

      1.Connecting with LDAP server through SSL trust store.

      So added following system properties :

      System.setProperty("javax.net.ssl.trustStore",
                          "path to jdk cacerts");
      System.setProperty("javax.net.ssl.trustStorePassword", "changeit");

      I am able to fetch the data correctly.

      2. I have to connect to another SSL server through webservice(axis2),where I will push these data.

      I am setting following system properties :

      System.setProperty("javax.net.ssl.keyStore", certFilePath);
      System.setProperty("javax.net.ssl.keyStorePassword", password);

      Now this step not happening and throwing handshake error.
      But If I execute only the 2nd steps(skipping ist step) with dummy data, I am able to push data correctly through web service.

      Can any one please guide me how to work for this requirement,where I need to finish two SSL connection/requests in one go.

      Thanks
        • 1. Re: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failur
          EJP
          So added following system properties :

          System.setProperty("javax.net.ssl.trustStore",
                              "path to jdk cacerts");
          System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
          Those are the defaults. You don't need to specify either of these.
          But If I execute only the 2nd steps(skipping ist step) with dummy data, I am able to push data correctly through web service.
          So there is something wrong with step 1. As it is unnecessary, remove it.
          • 2. Re: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failur
            837869
            Hi EJP,

            Thanks for the reply.
            But unfortunately after removing these setup lines from my code also it's showing handshake failure error in the 2nd step.

            Its strange that the 2nd SSL connection works fine, if the ist SSL connection with LDAP server fails.
            Both together doesn't work anyway. Ist connection only needs "trustStore" setup and throws exception if I setup "keystore" setup also.
            But the 2nd step needs "keystore" setup.

            Has any one used two SSL connection/requests in their project?
            • 3. Re: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failur
              EJP
              It's no good saying 'an exception'. Please post the entire exception, message, and stack trace in both cases.
              Has any one used two SSL connection/requests in their project?
              Practically everybody.
              • 4. Re: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failur
                837869
                Hi EJP, Bellow is my exception stack trace :


                org.apache.axis2.AxisFault: Received fatal alert: handshake_failure
                     at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
                     at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:98)
                     at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
                     at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
                     at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
                     at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
                     at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
                     at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
                     at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
                     at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:557)
                     at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199)
                     at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
                     at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
                     at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
                     at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:438)
                     at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
                     at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
                     at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
                     at com.verisign.www._2006._08.vipservice.VipSoapInterfaceServiceStub.getTokenInformation(VipSoapInterfaceServiceStub.java:5251)
                     at com.verisign.enterprise.usermigration.MigrateUser.getTokenStatus(MigrateUser.java:512)
                     at com.verisign.enterprise.usermigration.MigrateUser.main(MigrateUser.java:344)
                Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
                     at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
                     at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
                     at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1657)
                     at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:932)
                     at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
                     at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)
                     at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
                     at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
                     at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
                     at java.io.FilterOutputStream.flush(FilterOutputStream.java:123)
                     at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:94)
                     ... 19 more


                Thanks
                • 5. Re: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failur
                  837869
                  - I/O exception (org.apache.axis2.AxisFault) caught when processing request: Received fatal alert: handshake_failure
                  - Retrying request
                  - I/O exception (org.apache.axis2.AxisFault) caught when processing request: Received fatal alert: handshake_failure
                  - Retrying request
                  - I/O exception (org.apache.axis2.AxisFault) caught when processing request: Received fatal alert: handshake_failure
                  - Retrying request
                  Exception in thread "main" org.apache.axis2.AxisFault: Received fatal alert: handshake_failure
                       at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
                       at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:83)
                       at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84)
                       at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
                       at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
                       at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
                       at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
                       at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
                       at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
                       at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
                       at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:542)
                       at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:189)
                       at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
                       at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:371)
                       at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:209)
                       at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
                       at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)
                       at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
                       at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
                       at com.verisign.www._2006._08.vipservice.VipSoapInterfaceServiceStub.getTokenInformation(VipSoapInterfaceServiceStub.java:5252)
                       at com.verisign.enterprise.usermigration.MigrateUser.getTokenStatus(MigrateUser.java:514)
                       at com.verisign.enterprise.usermigration.MigrateUser.main(MigrateUser.java:326)
                  Caused by: com.ctc.wstx.exc.WstxIOException: Received fatal alert: handshake_failure
                       at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:313)
                       at org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush(MTOMXMLStreamWriter.java:146)
                       at org.apache.axis2.databinding.utils.writer.MTOMAwareXMLSerializer.flush(MTOMAwareXMLSerializer.java:79)
                       at org.apache.axis2.databinding.ADBDataSource.serialize(ADBDataSource.java:94)
                       at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerializeAndConsume(OMSourcedElementImpl.java:664)
                       at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:918)
                       at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:947)
                       at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:240)
                       at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:228)
                       at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:947)
                       at org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:471)
                       at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:79)
                       ... 20 more
                  Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
                       at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
                       at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
                       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1657)
                       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:932)
                       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
                       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)
                       at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
                       at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
                       at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
                       at org.apache.commons.httpclient.ChunkedOutputStream.flush(ChunkedOutputStream.java:191)
                       at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:99)
                       at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:214)
                       at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:311)
                       ... 31 more
                  - Unable to sendViaPost to url[https://vipha-auth.bbtest.net/mgmt/soap]
                  org.apache.axis2.AxisFault: Received fatal alert: handshake_failure
                       at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
                       at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:83)
                       at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84)
                       at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
                       at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
                       at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
                       at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
                       at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
                       at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
                       at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
                       at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:542)
                       at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:189)
                       at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
                       at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:371)
                       at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:209)
                       at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
                       at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)
                       at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
                       at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
                       at com.verisign.www._2006._08.vipservice.VipSoapInterfaceServiceStub.getTokenInformation(VipSoapInterfaceServiceStub.java:5252)
                       at com.verisign.enterprise.usermigration.MigrateUser.getTokenStatus(MigrateUser.java:514)
                       at com.verisign.enterprise.usermigration.MigrateUser.main(MigrateUser.java:326)
                  Caused by: com.ctc.wstx.exc.WstxIOException: Received fatal alert: handshake_failure
                       at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:313)
                       at org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush(MTOMXMLStreamWriter.java:146)
                       at org.apache.axis2.databinding.utils.writer.MTOMAwareXMLSerializer.flush(MTOMAwareXMLSerializer.java:79)
                       at org.apache.axis2.databinding.ADBDataSource.serialize(ADBDataSource.java:94)
                       at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerializeAndConsume(OMSourcedElementImpl.java:664)
                       at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:918)
                       at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:947)
                       at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:240)
                       at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:228)
                       at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:947)
                       at org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:471)
                       at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:79)
                       ... 20 more
                  Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
                       at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
                       at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
                       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1657)
                       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:932)
                       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
                       at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)
                       at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
                       at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
                       at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
                       at org.apache.commons.httpclient.ChunkedOutputStream.flush(ChunkedOutputStream.java:191)
                       at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:99)
                       at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:214)
                       at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:311)
                       ... 31 more