Keytool: How to solve Error?

A java microservice function exception in the environment, look at the logs reporting errors. PKIX path building failed: unable to find valid certification path to requested target

Reason: The self-signed certificate used by the customer is not trusted by jdk.

Import the customer domain SSL certificate into jdk library.

# export LANG=”en_US.UTF-8″
# openssl s_client -connect < /dev/null | sed -ne ‘/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p’ >
# keytool -import  -file  -alias  -keystore $JAVA_HOME/jre/lib/security/cacerts  –storepass “changeit” –noprompt   -trustcacerts

Restart the relevant java application and solve it.

Read More: