title: Getting ssl.SSLHandshakeException when using REST client with header but works fine with PostMan
body: <p>I have an external REST resource with below details:</p>
  
  <ol>
  <li>The URL:  <code>abc.com/orders</code> (the domain is with <code>https</code>)</li>
  <li>I need to pass UserID as an HTTP header with key "user" value is "abcd"</li>
  <li>This would return an JSON response</li>
  </ol>
  
  <p>I am using below Java code for this:</p>
  
  <pre><code>try {
  
              Client client = Client.create();
  
              WebResource webResource = client.resource("abc.com/orders");
  
              ClientResponse response = webResource.header("user", "abcd").accept("application/json")
                      .get(ClientResponse.class);
  
              if (response.getStatus() != 200) {
                  throw new RuntimeException("Failed : HTTP error code : " + response.getStatus());
              }
  
              String output = response.getEntity(String.class);
  
              System.out.println("Output from Server .... \n");
              System.out.println(output);
  
          } catch (Exception e) {
  
              e.printStackTrace();
  
          }
  </code></pre>
  
  <p>But I am getting below exception although it works fine with <code>PostMan</code></p>
  
  <pre><code>com.sun.jersey.api.client.ClientHandlerException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155)
      at com.sun.jersey.api.client.Client.handle(Client.java:652)
      at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
      at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
      at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:509)
  </code></pre>
  
  <p>I tried to search a bit on it and found somewhere that I need to get certificate from that URL and add to <code>jdk/lib/security</code> folder. But I don't know how to proceed.</p>
  
  <p>With openssl I get below output:</p>
  
  <pre><code>user&gt;openssl s_client -connect  abc.com:443
  
  CONNECTED(00000214)
  7832:error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error:s23_clnt.c:802:
  ---
  no peer certificate available
  ---
  No client certificate CA names sent
  ---
  SSL handshake has read 7 bytes and written 308 bytes
  ---
  New, (NONE), Cipher is (NONE)
  Secure Renegotiation IS NOT supported
  Compression: NONE
  Expansion: NONE
  No ALPN negotiated
  SSL-Session:
      Protocol  : TLSv1.2
      Cipher    : 0000
      Session-ID:
      Session-ID-ctx:
      Master-Key:
      Key-Arg   : None
      PSK identity: None
      PSK identity hint: None
      SRP username: None
      Start Time: 1531657560
      Timeout   : 300 (sec)
      Verify return code: 0 (ok)
  </code></pre>