I have googled it with issue. But those are not able to solve my problem.I have an issue with the SSL certificate in my code while calling a rest control.
My control method is:
@CrossOrigin(origins = "http://localhost:4200")
@RequestMapping(value = "/token", method = RequestMethod.POST, produces = "application/json")
public @ResponseBody TokenModel GetToken(@RequestBody RequestBodyJson requestBodyJson) {
TokenModel response = null;
RestTemplate restTemplate = new RestTemplate();
try {
response = new GenericRestClient<RequestBodyJson, TokenModel>().execute(
new RequestDetails(url, HttpMethod.POST), requestBodyJson, responseHandler,TokenModel.class);
restTemplate.getForEntity(url , TokenModel.class);
} catch (Exception e) {
System.out.println(e.getMessage());
}
return response;
}
Error is:-I/O error on POST request for "https://myurl.com": 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
can anyone can help me here?