title: Unable to find valid certification path to requested target - java
body: <p>I'm trying to connect to a website using a <a href="http://hc.apache.org/httpcomponents-client-4.3.x/httpclient/apidocs/org/apache/http/impl/client/DefaultHttpClient.html">HttpClient</a> object. It works fine for websites we normally use(Like google). But there is a web site, when I try to connect, my program gives this error..</p>
  
  <pre><code>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 sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
  at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1917)
  at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:301)
  at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:295)
  at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1369)
  ....................
  Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)
  at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
  at sun.security.validator.Validator.validate(Validator.java:260)
  ...............
  
  Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:145)
  at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:131)
  at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
  at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)
  ... 27 more
  </code></pre>
  
  <p>When I try to go to this url from the browser, I have to click <strong>continue anyway</strong>. Otherwise browser will not load the page. It gives a <strong>privacy error</strong> saying <strong>your connection is not private</strong>.</p>
  
  <p>How can I overcome this problem in my java application..? I want my software to connect with that url without any error or without asking any confirmation.</p>