0

I'm trying to call a SSL-secured api using a spring RestTemplate. Unfortunately I get the following Error. What am I doing wrong?

org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://thedomaintocall.com": java.security.cert.CertificateException: No name matching thedomaintocall found; nested exception is javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching thedomaintocall found
Christian Hager
  • 468
  • 6
  • 22
  • Probably your truststore does not contain the CA to verify the certificate of your API server (see https://www.baeldung.com/spring-boot-https-self-signed-certificate). Also maybe the cert of the server does not match its domain name. – Gaël Marziou Nov 10 '20 at 22:09
  • My API doesn't use a selfsigned certificate. It uses a certifiate issued by LetsEncrypt. Shouldn't that work automatically, or do I still have to import it into the trust-store? Also names seem to match. If I inpspect the certificate in the chrome devtools the CN is exactly the same as the servername in my url. – Christian Hager Nov 11 '20 at 07:42
  • You may have to import the CA certificate and all in the certification chain depending on which truststore you use, by default the one from the JRE I suppose or the one from your OS. https://stackoverflow.com/questions/54255998/lets-encrypt-certificate-not-working-while-using-on-java-api – Gaël Marziou Nov 11 '20 at 09:30

0 Answers0