PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Tuesday, November 24th, 2009If 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);
A known author of many java and flex-related articles
Entries (RSS)
Comments (RSS)