Hello all,
I have a
jsp page that calls a cold fusion web page over https, and reads the data found there. My code is as follows:
String urlString = /*https URL here*/
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
System.setProperty("https.proxyPort","myproxyport");
System.setProperty("https.proxyHost","myproxyhost");
System.setProperty("javax.net.ssl.trustStore","keystore"); System.setProperty("javax.net.ssl.trustStorePassword","keystore password");
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
URL url = new URL(urlString);
URLConnection conn_c = url.openConnection();
HttpURLConnection conn = (HttpURLConnection)conn_c;
conn.setDoOutput(true);
conn.setRequestMethod("POST");
InputStream stream = conn.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(stream));
String line = "";
String valid = "";
while( (line = in.readLine()) != null){
valid = line;
}
in.close();
This seems to work fine, but the jsp is crashing sometimes with the error: java.lang.ClassCastException: oracle.security.cert.X509CertificateImpl at the line of code where I open the InputStream from the connection. Once this starts, only an opmnctl stopall and startall seem to fix this error. Once this is working, it seems to continue working correctly for quite a while (a few days at least). We have other systems that use the same code, and they don't seem to suffer from this problem, does anyone have any idea what is incorrect here to cause this?
Thanks in advance