I'm trying to use HttpsURLConnection in java 7 (on windows 7) to connect to a remote web server and send a post request. Everything seems to work except for the fact that it doesn't trust the certificate (it's self signed).
I've exported the certificate through chrome and then imported the certificate into the keystore with this:
keytool -import -file mysslcertificate.cer
The certificate is there if I run keytool -list
.
When i try to run it (either using gradle or eclipse) after importing the certificate i get this exception:
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
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Anyone have any tips?