iGlow / Blog / PKIX path building failed

SAP CPI error

PKIX path building failed in SAP CPI

Short answer: This error means SAP CPI does not trust the certificate of the server it called. It usually happens when the server's root or intermediate certificate is missing from the tenant keystore, or was just renewed. To fix it, add those certificates in the Keystore monitor and run the TLS connectivity test.

The problem

Your message fails at the receiver step and the log shows a long Java stack trace that ends in "unable to find valid certification path to requested target". The server works in your browser, so it is hard to see what CPI is unhappy about. Which certificate is missing? Root or intermediate? You export, upload, redeploy and wait, then find the chain was still incomplete.

What does PKIX path building failed mean?

PKIX path building failed is a Java security error. CPI opened a secure connection (HTTPS, SOAP, SFTP over TLS and similar) and tried to check the server's certificate against the certificates in the tenant keystore. It could not build a chain from the server's certificate to a certificate it trusts, so it stopped before sending any data.

Full text in the log: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Why does it happen?

The most common cause comes first.

How do I fix PKIX path building failed in SAP CPI?

  1. Open the receiver URL in a browser and export the root and intermediate certificates as Base64 .cer files.
  2. In Cloud Integration open Monitor > Integrations and APIs > Manage Security > Keystore.
  3. Choose Add > Certificate and upload each file. Save.
  4. Resend the failed message.

How do I confirm it is fixed?

Open Manage Security > Connectivity Tests > TLS, enter the host and port, and tick Valid Server Certificate Required (see KBA 3574634). If the test is green, the chain is trusted.

Which adapter or step causes it?

Any adapter that opens an outbound TLS connection: HTTP, SOAP, OData, Mail and others. The error appears at the receiver step.

Tips to avoid it next time

Certificates expire and get renewed, so this error often returns months later. Note the expiry date of every receiver certificate you import. Import the full chain, not only the top certificate. If the call goes to a server you do not control, ask its owner to tell you before the certificate is renewed. For a deeper look at a failing call, trace the message step by step.

See all ten in the 10 most common SAP CPI errors and how to fix each for SAP Cloud Integration (SAP Integration Suite).

The easy way: fix PKIX path building failed with iGlow

iGlow is an AI agent for SAP Integration Suite and CPI that runs as a Chrome extension side panel. The hunt above is what the Fix button does for you.

  1. Open the panel on SAP Integration Suite. The failed message is listed with a Fix button.
  2. Click Fix. iGlow reads the error and the failing receiver step and explains that the server's certificate chain is not trusted by the tenant keystore.
  3. Follow the next steps it gives: which certificates to add in the Keystore monitor, and the TLS connectivity test to run. You add the certificates yourself, because iGlow does not add certificates to the keystore.
iGlow Fix answer for the demo iFlow Invoice_S4_to_Ariba: why the last message failed (a null amount, line 5 of mapInvoiceToCXML.groovy), the proposed fix marked rejected, and two options
What a Fix answer looks like: the root cause in plain words and options to choose from. This example is a different error, a null amount in a Groovy script. For a certificate error, iGlow explains the cause and lists next steps.
The Fix flow, shown on another error (a null amount in a Groovy mapping script in the demo iFlow Invoice_S4_to_Ariba): click Fix, read the cause, review the patch. In the clip the patch is rejected, so nothing changes. For a certificate error, iGlow gives next steps and does not change certificates.

Nothing is saved or deployed without your click, and tenants tagged PRD are never changed. See the Fix failed messages guide. Add iGlow to Chrome.

Questions

What does PKIX path building failed mean?

It means CPI could not link the server's certificate to a certificate it trusts. The tenant keystore is missing a root or intermediate certificate.

How do I fix PKIX path building failed in SAP CPI?

Export the server's root and intermediate certificates, add them in Manage Security > Keystore, and test with the TLS connectivity test.

Which adapter or step causes PKIX path building failed?

Any receiver step that makes an outbound TLS connection, such as the HTTP, SOAP or OData receiver adapter.

More from the blog and guides