How to fix SSLHandshakeException
Introduction
I have received this message when accessing a web service as a client in this URL
The WSDL document could not be parsed.The following error occured while parsing the WSDL location - WSDLException: faultCode=PARSER_ERROR: Failed to read wsdl file at: "https:/xxx?WSDL", caused by: javax.net.ssl.SSLHandshakeException. : 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
In StackOverflow is the solution
The CA-ROOT certificate must be included in the cacert file in java-home/lib/security/cacerts
Getting the CAcert certificate
Use Firefox and click in the padlock
Click in this symbol
Get more info
Show certificate
Click on the URL to download de CA certificate
and the CA certificate is downloaded as ACCOMP.crt in this case.
Importing the certificate into the java keystore
Now the certificate can be imported using this command
JAVA_HOME/bin/keytool -import -alias CA-FNMT -file ACCOMP.crt -keystore $JAVA_HOME/jre/lib/security/cacerts
where CA-FNMT is the alias I give to the certificate and ACCOMP.crt is the certificate I have downloaded.
This process can be done using the tool KeyStore Explorer. Open the cacerts keystore and import the downladed certificate
Now the error has disappeared. (Take care that you must trust this CA certificate!)
Comments
Post a Comment