PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
If you are getting this exception from your Java program using HTTPClient library, that means the site you are trying to connect to has a test/self-signed or invalid certificate. The easiest way to workaround this problem is to grab InsecureSSLProtocolSocketFactory and InsecureTrustManager from HTMLUnit project and before making a request use this code:
JAVA:
-
final ProtocolSocketFactory factory = new InsecureSSLProtocolSocketFactory();
-
final Protocol https = new Protocol("https", factory, 443);
-
Protocol.registerProtocol("https", https);