Reputation: 281
I am facing an issue while trying to run a RestClient through Java. I am using Apache HttpClient for building a rest client I have added the required certificates in the jdk cacerts file and also checked that they are present there.
Now when I am running my code from eclipse than the handshake is happening correctly without any error and I am able to send a POST request.
Now when I create a runnable jar file from eclipse with all jars packaged in it than while running I am encountering the error Error Occurred: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Can you all please help me in resolving this.
Upvotes: 3
Views: 2466
Reputation: 1026
Run your application with the following option:
java -Djava.security.debug=all ...
This will turn debugging on.
I'm assuming that your are running the jar file as a standalone application. If that is the case, the cacerts maybe different.
Upvotes: 1