|
Home > Archive > WebSphere Application Server > April 2006 > ClassCastException when creating a HttpURLConnection on WAS 6.0
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
ClassCastException when creating a HttpURLConnection on WAS 6.0
|
|
|
| We have a servlet which reads a configuration file from a remote server using a HttpURLConnection:
// the URL is set depending if in development or production
URL url = new URL(configFileUrl);
// then the HttpURLConnection is created
HttpURLConnection uc = (HttpURLConnection) url.openConnection();
This worked fine on WAS 5.1. When we were running it on WAS 6.0, we got a ClasscastException:
java.lang.ClassCastException: com.ibm.net.ssl.www2.protocol.http.bc
Using RAD 6 I was able to get a more informative message:
java.lang.ClassCastException: com/ibm/net/ssl/www2/protocol/http/bc incompatible with sun/net/www/protocol/http/HttpURLConnection
Does anyone know what the reason of this could be?
I applied the latest fixes (6.0.2.9), but the problem persists.
The JRE on the server:
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2)
Classic VM (build 1.4.2, J2RE 1.4.2 IBM Windows 32 build cn142ifx-20060209 (SR4-1) (JIT enabled: jitc))
| |
|
| you may import another class
check the imported classses and verify it is java.net.HttpURLConnection
| |
|
| Thanks for the hint.
I changed the import to java.net.HttpURLConnection and now it's running without any problem.
|
|
|
|
|