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
我使用这个简单的方法进行REST调用,我收到以下错误:
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
您是否可以建议一种简单的方法来绕过SSL证书验证,而无需使用this之类的httpBuilder
感谢您的帮助。