Based on various web inputs, I have followed the following steps to add certificate to my local jdk keystore:
Downloaded the certificates by hitting the following command from a Linux host: openssl s_client -connect MyService:443 -showcerts
Copied the content between (and including) ------BEGIN CERTIFICATE-------- and --------END CERTIFICATE---------, saved it as C:\Java\jre\lib\security\cer1.cer
Typed: C:\Java\jre\bin>keytool -keystore C:\Java\jre\lib\security\cacerts -importcert -alias cer1 -file C:\Java\jre\lib\security\cer1.cer
This showed a message the certificate added successfully. Which i verified by using list command for keytool
- Then i restarted my machine, and tried to run my Java program again, but still keep getting error:
"sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"
JDK Used: 1.8.0_31, Windows 7
Please help!