Skip to Content

PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is javax.net.ssl.SSLHandshakeException:

Certificate issue for oauth.

I have implemented commercewebservices. Using another java program i wants to authenticate and send some data. But while i am authenticating i am getting below error. Can someone help me on this.

 dHJ1c3RlZF9jbGllbnQ9c2VjcmV0
 21:31:20.026 [main] DEBUG org.springframework.web.client.RestTemplate - Created POST request for "https://localhost:9002/authorizationserver/oauth/token?client_id=trusted_client&client_secret=secret&grant_type=client_credentials&username=mark.rivers@rustic-hw.com&password=12341234"
 21:31:20.033 [main] DEBUG org.springframework.web.client.RestTemplate - Setting request Accept header to [text/plain, application/json, application/*+json, */*]
 Exception in thread "main" org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://localhost:9002/authorizationserver/oauth/token": sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is 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
     at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:666)
     at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:613)
     at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:531)
     at com.javainuse.SpringBootResourceServerApplication.main(SpringBootResourceServerApplication.java:54)
 Caused by: 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
     at sun.security.ssl.Alerts.getSSLException(Unknown Source)
     at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
     at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
     at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
     at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
     at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
     at sun.security.ssl.Handshaker.processLoop(Unknown Source)
     at sun.security.ssl.Handshaker.process_record(Unknown Source)
     at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
     at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
     at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
     at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
     at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
     at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
     at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)
     at org.springframework.http.client.SimpleBufferingClientHttpRequest.executeInternal(SimpleBufferingClientHttpRequest.java:78)
     at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
     at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
     at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:652)
     ... 3 more
 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(Unknown Source)
     at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
     at sun.security.validator.Validator.validate(Unknown Source)
     at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)
     at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)
     at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
     ... 18 more
 Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
     at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source)
     at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
     at java.security.cert.CertPathBuilder.build(Unknown Source)
     ... 24 more
 

Add a comment
10|10000 characters needed characters exceeded

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.