0

I have two servlets (A and B) running in one tomcat server(v8). Both of them need talk to third party interface.

A is using a keystore.xml which contains all the credential information(using Keystore.jar) and calls the third party(A1) jar function to send request and get response..

B is using third party(B1)'s webservice and set the ssl keystore as below. System.setProperty("javax.net.ssl.keyStoreType", "JKS"); System.setProperty("javax.net.ssl.keyStore", "C:\test.jks"); System.setProperty("javax.net.ssl.keyStorePassword", "test");

        System.setProperty("javax.net.ssl.trustStoreType", "JKS");
        System.setProperty("javax.net.ssl.trustStore", "C:\\test.jks");
        System.setProperty("javax.net.ssl.trustStorePassword", "test"); 

The issue I am having is if I run serlvet A then A will work but B will have the error "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".

If I run B first then B is working fine but A will have the same error. It looks like there is a conflict? I don't understand why it happened. It doesn't seem like missing certificates in keystore file cause each time after I restart tomcat then either A or B works fine.

Hope I descript my question clearly and thanks for all your help.

Andy Shao
  • 15
  • 4
  • You need to use the same means to identify the truststore in both servlets. – user207421 Mar 22 '16 at 00:37
  • Possible duplicate of [Resolving javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed Error?](http://stackoverflow.com/questions/9619030/resolving-javax-net-ssl-sslhandshakeexception-sun-security-validator-validatore) – worpet Mar 23 '16 at 15:51

0 Answers0