Posts

Showing posts from November, 2020

Solve "unable to find valid certification path to requested target" by Installing Certificate to JDK - Java Spring Boot RestTemplate

 This is the case when I'm trying to hit a web service in my Spring Boot application using RestTemplate. The solutions I found on the internet and stack overflow is to disable SSL certificate checking, which is actually not recommended if you're trying to access a secured service (using HTTPS). The workaround I found is to install the certificate from the web service itself into our JDK (inject certificate). First we need to get the certificate. There are two ways though, the first is to save the certificate from the browser. The second is asking politely to service provider. Get Certificate: Save from Browser To use this step, first access the URL of the service. Example if the service is "https://secured-service.example.com/hit-me/to-send-something", then you just need to enter the main domain (https://secured-service.example.com) in the browser. Then, use this following steps: I assumed you're using Google Chrome or newest chrome-based Edge, click the lock butt...