I am developing a REST API using Spring Boot and trying to connect to an SSO(https) on my network. Everything worked fine until the ssl cerificate on the SSO was recently updated. Now I keep getting the following error.
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(PKIXValidator.java:387) ~[na:1.8.0_121]
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292) ~[na:1.8.0_121]
at sun.security.validator.Validator.validate(Validator.java:260) ~[na:1.8.0_121]
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324) ~[na:1.8.0_121]
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229) ~[na:1.8.0_121]
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124) ~[na:1.8.0_121]
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1496) ~[na:1.8.0_121]
... 90 common frames omitted
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141) ~[na:1.8.0_121]
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126) ~[na:1.8.0_121]
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280) ~[na:1.8.0_121]
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382) ~[na:1.8.0_121]
... 96 common frames omitted
I have looked at other answers ans 1, ans 2 for the same problem and I have tried to add all the cerificates in the chain to keystore and it is still giving me the same exception. I have restarted the pc several times now.
When I check the keystore using list command I can see my ceritficates are present in the list but it still doesnt work.
So what am I doing wrong?
I am using Spring Boot 2.3.3 on Intellij IDEA 2020.2 and everything worked fine, even the SSO was validating the tokens but recently the SSO's ssl certifcate was updated. It is a self-signed certificate from Lets Encrypt. But I am not sure how that could be a problem since the previous certificate was also from Lets Encrypt.