• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

X509CertificateImpl CastException in JSP

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic