Home >Java >javaTutorial >How to Fix javax.net.ssl.SSLHandshakeException in PayPal Express Checkout Integration?

How to Fix javax.net.ssl.SSLHandshakeException in PayPal Express Checkout Integration?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-12-03 06:59:13642browse

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:

  1. Obtain the Server Certificate:

Obtain the public certificate from PayPal's server. Contact PayPal's support for guidance or download the certificate using OpenSSL.

  1. Import Certificate into Trust Store:

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>
  1. Enter the Default Password:

When prompted for a password, enter the default password "changeit".

  1. Execute the Command:

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn