4
def connection = new URL( 'someURL.com')
    .openConnection() as HttpURLConnection
    connection.setRequestProperty( 'Accept', 'application/json' )

    // get the response code - automatically sends the request
    println connection.responseCode + ": " + connection.inputStream.text

I used this simple method to make REST call and I get the below error:

    Caught: 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
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 Example.findUserInUsamPGroup(findUserInUsamPGroup.groovy:33)
    at Example.main(findUserInUsamPGroup.groovy:3)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    ... 2 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    ... 2 more

Could you suggest an easy way to bypass SSL certificate verification without having to use httpBuilder like this

Thanks for the help.

Light Yagami
  • 61
  • 1
  • 2
  • 4
  • 1
    Possible duplicate of [Allowing Java to use an untrusted certificate for SSL/HTTPS connection](https://stackoverflow.com/questions/1201048/allowing-java-to-use-an-untrusted-certificate-for-ssl-https-connection) – Szymon Stepniak Apr 05 '18 at 08:18

0 Answers0