Ignore certificate errors when requesting a URL in Java

Posted by Ryan Elkins on Stack Overflow See other posts from Stack Overflow or by Ryan Elkins
Published on 2010-04-22T20:36:06Z Indexed on 2010/04/22 20:43 UTC
Read the original article Hit count: 384

Filed under:
|

I'm trying to print a URL (without having a browser involved at all) but the URL is currently throwing the following:

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

I'm calling the URL using a JEditorPane's setPage method, which just takes a URL as a parameter. Assuming I can't change anything server side and I still need to get to this resource, how would I go about ignoring the certificate error (or something else that gets me to my goal)?

Accessing this URL via a browser tells me the site is untrusted and asks me if I want to proceed.

© Stack Overflow or respective owner

Related posts about java

Related posts about ssl-certificate