title: How to resolve SSLHandshakeException ? Why am I getting it?
body: <p>I am using <code>java ee 6</code> and <code>tomcat</code>. One of the statement throws the following exception :</p>
  
  <pre><code>sun.security.validator.ValidatorException: PKIX path building failed: 
  sun.security.provider.certpath.SunCertPathBuilderException: unable to 
  find valid certification path to requested target
  .
  .
  Caused by: 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
  </code></pre>
  
  <p>My application uses an API that talks to the <code>Twitter API</code>. In the following snippet that commented statement throws an exception:</p>
  
  <pre><code>try {
          RequestToken rToken = twitter.getOAuthRequestToken(); //THROWS EXCEPTION
          authURL = rToken.getAuthorizationURL();
      }catch(Exception exc) {
          System.out.println("$$$$$$$$Inside exception block$$$$$$$$$$");
          exc.printStackTrace();
      }
  </code></pre>
  
  <p>What could be the reason for this exception ?</p>