After updating java version from 1.8.0_231 to 1.8.0_241, I am getting errors related to certificate confiugation.
During spring boot starup I am setting keystore and keystorepass and making a rest call with the help of RestTemplate provided by Spring framework.
After invoking rest service I am getting 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 error.
The same code was working fine with JDK 1.8.0_231. Can any help me what's creating the problem.
I configured keystore and keystorepassowrd as shown below
System.setProperty("javax.net.ssl.keyStore", environment.getProperty("javax.net.ssl.keyStore"));
String pswd = null;
try (BufferedReader br = new BufferedReader(
new InputStreamReader(new
FileInputStream(environment.getProperty("javax.net.ssl.keyStorePassword")), Charset.defaultCharset()))) {
pswd = br.readLine();
if (pswd != null) {
System.setProperty("javax.net.ssl.keyStorePassword", pswd);
}
}