KB-2242 "PKIX path building failed" error seen when sending emails in a self-managed Kubernetes install
Symptoms
Sending emails over HTTPS fails with the following error in the webapp pod log:
jakarta.mail.MessagingException: Could not convert socket to TLS;
...
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Cause
This is because the certificate being presented by the SMTP server is not trusted by the webapp pod for one of the following reasons:
- The certificate is self-signed.
- The certificate is signed by a Certificate Authority, but the server is not presenting the full certificate chain with all intermediate certs up to the CA root cert.
Action
The external certificate needs to be added to the default Java trust store. This can be done by following the instructions below:
- Extract the default Java trust store from the Appian webapp deployment:
kubectl -n *namespace* cp <APPIAN_SITE_NAME>-webapp-0:/usr/local/appian/ae/java/lib/security/cacerts ./cacerts
- Import the target server’s certificate and CA root certificate into the cacerts trust store:
keytool -import -alias targetServerCert -file ./<TARGET_SERVER_CERT>.PEM -keystore ./cacerts -storepass changeitkeytool -import -alias myRootCA -file ./<ROOT_CA>.pem -keystore ./cacerts -storepass changeit
- Confirm that the certificates were added to the cacerts trust store:
keytool -list -keystore ./cacerts -storepass changeit
- Create a secret based on the above cacerts file:
kubectl create secret generic cacerts-secret --from-file=keystore.jks=./cacerts -n <APPIAN_SITE_NAMESPACE>
- Configure the Appian Custom Resource to mount the customized trust store by adding the following in the Appian site yaml, under
.spec.webapp
additionalVolumes: - name: keystore-secret secret: secretName: "cacerts-secret" items: - key: keystore.jks path: cacerts additionalVolumeMounts: - name: keystore-secret mountPath: /usr/local/appian/ae/java/lib/security/cacerts subPath: cacerts readOnly: true
- Start the Appian site. You will find your customized cacerts trust store at
/usr/local/appian/ae/java/lib/security/cacertsalongside other original files in the~/securitydirectory
Affected Versions
This article applies to all versions of self-managed Appian on Kubernetes.
Last Reviewed: July 2025
