title: Java HttpClient throws SSLHandshakeException when executing GET to https url
body: <p>I'm running a small main (in Java 8, version 1.8.0.112) to try and execute an HTTP request to an "<strong>https</strong>" url, lets call it "original_url". I'm using a standard CloseableHttpClient, creating it this way:</p>
  
  <pre><code>CloseableHttpClient httpClient = HttpClientBuilder.create()
              .setConnectionManager(new PoolingHttpClientConnectionManager())
              .setDefaultRequestConfig(RequestConfig.DEFAULT)
              .build();
  </code></pre>
  
  <p>But when I hit:</p>
  
  <pre><code>httpClient.execute(request);
  </code></pre>
  
  <p>I'm getting this error:</p>
  
  <pre><code>javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
  </code></pre>
  
  <p>(Full stacktrace bellow) </p>
  
  <p>The weird thing is that when I reach different "https" urls from the same java code it works fine. Also, when I reach the "original_url" from Chrome or Postman (REST client) I succeed reaching to it. I also tried executing the http call to the "original_url" from a php code and it works fine.</p>
  
  <p>I looked for many answers in StackOverflow, all trying to set the HttpClient to ignore unknown certificates, but it didn't work. Also it seems the certificate of the site isn't expired since I can reach to the "original_url" site from Chrome/Postman/php code.</p>
  
  <p>Could it be there is a problem with the JVM keystore? Any help would be much appreciated.</p>
  
  <p>Here is the full exception stack trace:</p>
  
  <pre><code>Exception in thread "main" 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:2023)
  at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1125)
  at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
  at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
  at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
  at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394)
  at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
  at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
  at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
  at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
  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:82)
  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
  at com.taboola.jobs.crawler.geoedge.RestAdapterBuilder.main(RestAdapterBuilder.java:127)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
  </code></pre>