Issue
I could successfully connect to my website using my java class.
URLConnection myURLConnection=null; URL myURL=null; BufferedReader reader=null;
String mainUrl="https://example.com/ServCon/ServConI?";
StringBuilder sbPostData= new StringBuilder(mainUrl);
sbPostData.append("page=").append(mpage);
mainUrl = sbPostData.toString();
try {
//prepare connection
myURL = new URL(mainUrl);
myURLConnection = myURL.openConnection();
myURLConnection.connect();
reader= new BufferedReader(new
InputStreamReader(myURLConnection.getInputStream(),"UTF-8"));
} catch(Exception e) {
System.out.println(e);
}
But the problem is when I am trying to connect from jsp file using same java class then I am getting error:
e = (SSLHandshakeException) 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
I am using Glassfish 5.1.0 jdk 1.8.0_301 and apache Netbeans 12.5
Solution
Well! I have have been struggling for last few days. Finally I could resolve the issue. The problem was Glassfish server. I replaced with Tomcat 9 server. But it want not working with that also. Then finally I realized that Tomcat 9 server need to be stop because NetBeans start at it on while executive web based project like jsp / servlet. It worked fine. Thanks
Answered By - ICL Sales EXIMON
Answer Checked By - Gilberto Lyons (JavaFixing Admin)