unable to find valid certification path to requested target--Sun Are u ther

Hi ,

I am trying to establish an https connection to a Web-application in Tomcat .

I have generated a keystore and trustore and have used a standalone Client application to use the above files and establish contact with a remote web-application . I have also added keystore file in the bin folder of tomcat server . Also made changes to the <connector parameter > in server.xml to include my keystore and its keypass.

But on running my client application to connect to Tomcat i get the following error :-

Caused by:sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:221)

at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:145)

at sun.security.validator.Validator.validate(Validator.java:203)

at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:172)

at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(SSLContextImpl.java:320)

at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:841)

Can anybody please throw some light on it ?

best regards

D

[1372 byte] By [dynamicdhiraja] at [2007-11-27 10:30:39]
# 1

Hi,

I added the following attributes in my Java code and was able to eliminate the above error .

System.setProperty("javax.net.ssl.keyStore", KEYSTORE_URL) ;

System.setProperty("javax.net.ssl.keyStorePassword", KEYSTORE_PW) ;

System.setProperty("javax.net.ssl.trustStore", TRUSTSTORE_URL) ;

System.setProperty("javax.net.ssl.trustStorePassword", TRUSTSTORE_PW) ;

The above system propertiessets the keystore Location and Password. .However I have now hit across a new error which says

java.net.SocketException: Default SSL context init failed: null

at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:176)

Can anyone please help me ?

dynamicdhiraja at 2007-7-28 18:04:21 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 2

Hi,

I found the solution to the above mentioned error . I erroneously set the system property for the keystore at the client side .

It should have been this way :-

//System.setProperty("javax.net.ssl.keyStore", KEYSTORE_URL) ;

//System.setProperty("javax.net.ssl.keyStorePassword", KEYSTORE_PW) ;

System.setProperty("javax.net.ssl.trustStore", TRUSTSTORE_URL) ;

System.setProperty("javax.net.ssl.trustStorePassword", TRUSTSTORE_PW) ;

Also, the error in this case was the inability of my jvm to locate the Truststore file .I had mentioned the absolute path of the truststore file in the above URL whereas the jvm demands a relative path .

dynamicdhiraja at 2007-7-28 18:04:21 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...