Error javax net ssl SSLHandshakeException Error

0 votes

Connected with VPN to setup the inventory API to get product list and it works fine.

Once I get the result from the web-service and I bind to UI. And also I integrated PayPal with my application for make Express checkout when I make a call for payment I'm facing this error.

 I use servlet for back-end process. How to fix this issue?

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
May 21, 2020 in Java by kartik
• 37,520 points
1,999 views

1 answer to this question.

0 votes

Hello @kartik,

First, you need to obtain the public certificate from the server you're trying to connect to. That can be done in a variety of ways, such as contacting the server admin and asking for it, using OpenSSL to download it, or, since this appears to be an HTTP server, connecting to it with any browser, viewing the page's security info, and saving a copy of the certificate.

Now that you have the certificate saved in a file, you need to add it to your JVM's trust store. At $JAVA_HOME/jre/lib/security/ for JREs or $JAVA_HOME/lib/security for JDKs, there's a file named cacerts, which comes with Java and contains the public certificates of the well-known Certifying Authorities. To import the new cert, run keytool as a user who has permission to write to cacerts:

keytool -import -file <the cert file> -alias <some meaningful name> -keystore <path to cacerts file>

It will most likely ask you for a password. The default password as shipped with Java is changeit. Almost nobody changes it. 

Hope this is helpful!!

answered May 21, 2020 by Niroj
• 82,840 points

Related Questions In Java

0 votes
1 answer

How can we handle the javax.net.ssl.SSLHandshakeException?

import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import java.io.OutputStream; // ...READ MORE

answered Oct 10, 2018 in Java by Daisy
• 8,140 points
2,572 views
0 votes
1 answer

How do I resolve the "java.net.BindException: Address already in use: JVM_Bind" error?

If you are aware about what port ...READ MORE

answered Feb 22, 2022 in Java by Aditya
• 7,680 points
5,109 views
0 votes
1 answer

How to fix the error failed to load the JNI shared Library?

You need these three things : 64-bit OS 64-bit ...READ MORE

answered Apr 19, 2018 in Java by sophia
• 1,400 points
2,581 views
0 votes
1 answer

Following error is occurring "Can't start Eclipse - Java was started but returned exit code=13"

There are combinations of Operating System, JDK ...READ MORE

answered Apr 19, 2018 in Java by Rishabh
• 3,620 points
2,975 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
0 votes
1 answer

Error:The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path

Hello @kartik, Include servlet-api-3.1.jar in your dependencies. Maven <dependency> ...READ MORE

answered Jun 3, 2020 in Java by Niroj
• 82,840 points
4,299 views
0 votes
1 answer

Error:jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

Hello @kartik, The servlet API .jar file must ...READ MORE

answered Jun 3, 2020 in Java by Niroj
• 82,840 points
4,142 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP