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