Frequently Asked Question

Tomcat HTTPS: fixing the "PKIX path building failed" error
Dernière mise à jour il y a env. un mois

Tomcat HTTPS: fixing the "PKIX path building failed" error (ex. DigiCert / GeoTrust / wildcard certificate)

7 oct. 2026 · @NEED4VIZ

Symptom

Tomcat writes an SSLHandshakeException to its stderr, with the root cause PKIX path building failed: unable to find valid certification path to requested target. It appears when Tomcat's JVM opens an HTTPS connection to a server (often the same server, through its public name) whose certificate is a wildcard issued by a DigiCert authority.

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException:
  PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
  unable to find valid certification path to requested target

In short: the JVM knows the root (DigiCert Global Root G2), but the server does not send the intermediate certificate (GeoTrust TLS RSA CA G1). The lasting fix is to make Tomcat send the complete chain, not to edit the cacerts file.

Why does this error occur?

A certificate is accepted only if the JVM can follow the chain of signatures up to a root it trusts. The chain has three links:

Link

Example here

Where it must be

Root

DigiCert Global Root G2

In the JVM's cacerts (shipped by default)

Intermediate

GeoTrust TLS RSA CA G1

Sent by the server during the connection

Leaf certificate

Your wildcard

Sent by the server

The cacerts file is the JVM's store of trusted roots, and it already contains the root. The problem is that the PFX used by the Tomcat connector holds only the wildcard. The server therefore does not send the intermediate, the JVM cannot link the wildcard to the root, and the connection is rejected.

Why not import the wildcard into cacerts? It works (the JVM then trusts the wildcard directly), but the wildcard is renewed every 6 months: the operation must be repeated each time, and forgetting it causes an outage. Moreover, the maximum validity of public certificates keeps shrinking (200 days since March 2026, then 100 and 47 days according to the CA/Browser Forum schedule, to be confirmed), so the manual step would become ever more frequent.

Why fix it on the server side? A properly configured server always sends the full chain (leaf + intermediate). Every client benefits, not just Java, and renewing the wildcard never again touches cacerts.

Diagnosis: which chain does the server send?

From a workstation or the server itself, display the certificates sent by the connector (replace myserver and the port):

openssl s_client -connect myserver:8443 -servername myserver -showcerts < NUL

On Linux, replace < NUL with . On Windows, openssl is available with Git for Windows, for example.

In the Certificate chain section:

  • Only 0 s: (your wildcard): the chain is incomplete, which is the cause of the error.
  • 0 s: (wildcard) and 1 s: (GeoTrust TLS RSA CA G1): the chain is complete and the error comes from elsewhere (another server, another certificate, the server clock, a proxy intercepting TLS).

Recommended fix: rebuild the PFX with the full chain

The Tomcat connector sends whatever its PFX file contains. There is therefore nothing to change in server.xml: you only need a PFX that holds the private key, the wildcard and the intermediate. The existing connector stays as is:

  1. Back up the current PFX.
    copy C:\SAPBI\SSL\my_certificat.pfx C:\SAPBI\SSL\my_certificat.pfx.bak
  2. Get the GeoTrust TLS RSA CA G1 intermediate in PEM format: either from the bundle DigiCert supplied with the wildcard, or from DigiCert's certificate page ("Intermediate" section). If it is in DER (binary) format, convert it:
    openssl x509 -inform der -in GeoTrustTLSRSACAG1.crt -out intermediate.pem
  3. Extract the private key and the wildcard from the old PFX.
    openssl pkcs12 -in C:\SAPBI\SSL\my_certificat.pfx -nocerts -nodes -out key.pem
    openssl pkcs12 -in C:\SAPBI\SSL\my_certificat.pfx -clcerts -nokeys -out leaf.pem
  4. Rebuild a PFX that includes the chain. Keep the same password so keystorePass stays untouched. Do not add the root: the client already knows it.
    openssl pkcs12 -export -inkey key.pem -in leaf.pem -certfile intermediate.pem -name tomcat -out C:\SAPBI\SSL\my_certificat_chain.pfx
  5. Check the contents. The output must show Certificate chain length: 2.
    keytool -list -v -keystore C:\SAPBI\SSL\my_certificat_chain.pfx -storetype PKCS12
  6. Plug in the new file: rename it to my_certificat.pfx, or change keystoreFile (and keystorePass if the password changed), then restart Tomcat.
  7. Verify with the openssl s_client command from the diagnosis: both certificates (0 s: and 1 s:) must appear and the PKIX error must be gone, without adding anything to cacerts.
  8. Clean up: delete key.pem and leaf.pem, which hold the private key in clear text.

If OpenSSL 3.x produces a PFX that an older JVM cannot read, add -legacy to the openssl pkcs12 -export command.

Alternative solutions

Solution

Principle

Limits

Import the intermediate into cacerts

The JVM then knows GeoTrust TLS RSA CA G1 and can link the wildcard to the root

Fixes only that JVM; must be repeated on every client JVM and after any JVM update that replaces cacerts; becomes obsolete if the issuing authority changes

Let the JVM download the intermediate (AIA extension)

JVM option -Dcom.sun.security.enableAIAcaIssuers=true (enabled by default on recent JDKs)

Requires outbound HTTP access from the server to cacerts.digicert.com (proxy, firewall); less reliable

Import the wildcard into cacerts

The JVM trusts the certificate directly

Must be redone at every renewal (every 6 months): not recommended

Command to import the intermediate if you choose this route (back up cacerts first, check the fingerprint and expiry date of the downloaded file, then restart Tomcat):

keytool -importcert -trustcacerts -alias geotrust-tls-rsa-ca-g1 -file GeoTrustTLSRSACAG1.crt -keystore \cacerts -storepass changeit

Use the keytool of the JVM that runs Tomcat, not one from another JVM on the server.

Renewals and frequently asked questions

At each wildcard renewal: redo only steps 3 to 6 of the recommended fix with the new key and certificate, reusing the same intermediate.pem. cacerts is never modified again. If DigiCert has the new wildcard issued by a different intermediate, the certificate delivery names it: download that new intermediate instead.

Is the "Nov 23, 2017" date shown by keytool -list an expiry date? No, it is the date the entry was added to the keystore. The real validity is shown by keytool -list -v (the Valid from … until … line).

Should the digicertglobalrootg2 entry in cacerts be updated? No: the DigiCert Global Root G2 root is valid until 2038. To refresh all roots at once, update the JVM (SAPJVM / JDK patch) rather than editing cacerts entry by entry.

The error persists after changing the PFX. Check that Tomcat was restarted, that keystoreFile points to the new file, that openssl s_client shows two certificates, and that the JVM producing the error is the one running this Tomcat.

Security. The wildcard's private key must never stay in clear text: delete the temporary .pem files and restrict access to the PFX and its backup.

Veuillez patienter!

S'il vous plaît patienter... il faudra une seconde !