Getting SSLhandshake exception even after the security certificate is installed

2.1k Views Asked by At

" java.lang.RuntimeException: 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"

I am getting the above excception when trying to connect to a website through jwebuint program. I have already imported the certificate keytool commmand.

I got strucked up here. Please help me out. Thanks..

2

There are 2 best solutions below

0
On BEST ANSWER

Thank you all..

Solution: There will be two JRE's -one is under jdk1.2... and second one is directly under java folder. You need to install or import the website security certificates using keytool command under the jre which is in your ide's installed JRE's

For Eclipse IDE: go to windows->preferences-> installed jre's Then it will show you the installed jre's path.

You need to import the certificate into that particular jre..

Using the keytool command is as follows: C:\Program Files\Java\jre6\bin>keytool -import -alias aliasname -keystore ..\lib\security\cacerts -file "D:\Softwares\certificates\mycert.cer"

1
On
  1. Run with the debug flags on (-Djavax.net.debug=ssl,handshhake)
  2. Do you instruct the JVM about the correct location of the keystore/truststore? (javax.net.ssl.keyStore, javax.net.ssl.trustStore, javax.net.ssl.keyStorePassword)