I`m making calls to the outbound REST API from Salesforce via Batch apex. Most of the calls are working fine, except in some cases, Im getting below error. For example, if I run 200 batches (with batch size as 1), Im getting atleast 10 batches fail per execution but remaining 190 work fine.

First error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target


1 Answer 1


This happens when your endpoint uses a Load Balancer.

So when you make calls in quick succession the Load Balancer Splits them to different servers. This is the reason why it doesn't happen every time and in few occurrences.

enter image description here.

So in One of the end server, the certificate assigned is not valid or properly configured.

Once your 3rd party guy configures Valid certificate you will stop seeing this issue.

Salesforce only supports a certain set of certificates, you can view them here.


Image Source: Google.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .