I\'m using Apache HttpComponents HttpClient(4.0.1) to make a HTTPS call, but I\'m this exception as the response:
javax.net.ssl.SSLPeerUnverifiedException: peer
The exception message
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
doesn't always indicate the root cause of the issue.
You may need to enable the SSL handshake debug by adding theJava VM parameter -Djavax.net.debug=ssl:handshake
.
Once you've added that you will get more helpful error messages.
If the remote server uses a certificate that is not trusted you will see the following error message:
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 that is the case then the answer by @Abhishek will solve the issue.