(test.LoginTest) 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
A Groovy (ez egy java "bővítés") kód:
import ...
def siteUrl = 'https://www.otpbank.hu/OTP_Portal/online/index.jsp' // nem a reklám helye
def httpClient = new HttpClient()
def getMethod = new GetMethod( siteUrl )
getMethod.setFollowRedirects( true )
httpClient.executeMethod ( getMethod )
A megoldás, be kell importálni a helyi keystore-ba (JRE/JDK keystore - JAVA_HOME/lib/security/cacerts) a szerver SSL certificate-jét. Erre Andreas Sterbenz nevű úr írt egy kis programot ( blogs.sun.com/andreas/resource/InstallCert.java ). Ez a Java keystore-ban lévő cert-ekhez hozzáadja a megadottat, és kiírja jssecacerts néven. Na és ezután a fenti kód:import ...
System.setProperty("javax.net.ssl.trustStore", 'jssecacerts')
def siteUrl = 'https://www.otpbank.hu/OTP_Portal/online/index.jsp' // nem a reklám helye
...