Java Certificates

Pods

Inable to find valid certification path to requested target

05-01-2026, source: StackOverflow

org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://a.b/c": PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

The certificate needs to be imported into cacerts TrustStore of the used JDK.

  1. Export a Base64-encoded ASCII, single certificate as a .pem file from the browser (usually the first option) and save it as whatever-certificate.pem.

  2. (Optional) Locate the cacerts TrustStore location of the used Java.

    echo $JAVA_HOME/lib/security/cacerts
  3. Import the certificate into cacerts TrustStore. Don’t forget to change the whatever-certificate-alias alias.

    sudo keytool -import -trustcacerts -alias whatever-certificate-alias -file /Users/Foo/whatever-certificate.pem -keystore $JAVA_HOME/lib/security/cacerts