Home >Java >javaTutorial >How to Fix javax.net.ssl.SSLHandshakeException in PayPal Express Checkout Integration?
How to Resolve javax.net.ssl.SSLHandshakeException for PayPal Express Checkout
When integrating PayPal with your Java application, you may encounter the following error while making Express Checkout calls:
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
This error indicates a problem with SSL certificate validation. To fix it, follow these steps:
Obtain the public certificate from PayPal's server. Contact PayPal's support for guidance or download the certificate using OpenSSL.
Import the obtained certificate into your JVM's trust store using keytool:
keytool -import -file <the cert file> -alias <some meaningful name> -keystore <path to cacerts file>
When prompted for a password, enter the default password "changeit".
Execute the keytool command and your certificate will be imported into the trust store.
After completing these steps, your application should communicate securely with PayPal's server and you will be able to make Express Checkout payments without encountering the SSL handshake error.
The above is the detailed content of How to Fix javax.net.ssl.SSLHandshakeException in PayPal Express Checkout Integration?. For more information, please follow other related articles on the PHP Chinese website!