Menu

#1790 javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

2.15
closed
handshake (1)
1
2016-05-26
2016-05-26
qiang tang
No

Hello,

I got SSLHandshakeException with the version htmlunit-2.14 as follow, Cloud you help to find out the root reason?

JDK: 1.7.0_75

Exception message:
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1979)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1086)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:275)
at org.apache.http.impl.conn.HttpClientConnectionOperator.upgrade(HttpClientConnectionOperator.java:167)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.upgrade(PoolingHttpClientConnectionManager.java:329)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:398)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:85)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:179)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1297)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1214)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:325)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:394)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:379)
at Test.main(Test.java:30)

Java Code:

public class Test {
    public static void main(String[] args){
        WebClient webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_11);

        // for local testing
        ProxyConfig proxyConfig = new ProxyConfig();
        proxyConfig.setProxyHost("cdc-s-tmg1");
        proxyConfig.setProxyPort(8080);
        webClient.getOptions().setProxyConfig(proxyConfig);

        webClient.getOptions().setPrintContentOnFailingStatusCode(false);
        webClient.getOptions().setThrowExceptionOnScriptError(false);
        webClient.getOptions().setUseInsecureSSL(true);
        webClient.getOptions().setRedirectEnabled(true);

        String Url = "https://wfr.partnersonline.com/ibi_apps/WFServlet.ibfs";

        Log.debug("Login target web site with Url:" + Url);
        try {
            HtmlPage page = webClient.getPage(Url);
        } catch (Exception e) {
            e.printStackTrace();
        }finally{
            webClient.closeAllWindows();
        }
    }
}

Discussion

  • Ahmed Ashour

    Ahmed Ashour - 2016-05-26
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -33,6 +33,7 @@
    
     Java Code:
    
    +~~~
     public class Test {
         public static void main(String[] args){
             WebClient webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_11);
    @@ -61,3 +62,4 @@
             }
         }
     }
    +~~~
    
     
  • Ahmed Ashour

    Ahmed Ashour - 2016-05-26

    2.14 is old.

    With latest version, I don't get an exception, please give it a try.

     
    • qiang tang

      qiang tang - 2016-05-26

      With 2.21, I got the exception as well, please help to try the URL: https://wfr.partnersonline.com/ibi_apps/WFServlet.ibfs

      Java Code:
      WebClient webClient = new WebClient();
      String Url = "https://wfr.partnersonline.com/ibi_apps/WFServlet.ibfs";
      HtmlPage page = webClient.getPage(Url);
      Exception Messge:
      javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
      at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
      at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
      at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1979)
      at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1086)
      at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332)
      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359)
      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343)
      at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394)
      at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.upgrade(DefaultHttpClientConnectionOperator.java:192)
      at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.upgrade(PoolingHttpClientConnectionManager.java:369)
      at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:415)
      at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
      at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
      at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
      at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
      at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
      at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
      at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:184)
      at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1357)
      at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1274)
      at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:382)
      at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:304)
      at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:451)
      at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:436)

       
  • Ahmed Ashour

    Ahmed Ashour - 2016-05-26
    • status: open --> pending
     
  • Ahmed Ashour

    Ahmed Ashour - 2016-05-26
     
    • qiang tang

      qiang tang - 2016-05-26

      Changed JDK to 1.8, It works. Thanks you for your help!

       
  • Ahmed Ashour

    Ahmed Ashour - 2016-05-26
    • status: pending --> closed
    • assigned_to: Ahmed Ashour
     

Log in to post a comment.