Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

HTTPS ClassCastException for SOAPHttpsURLConnection to HttpsURLConnection

659191Apr 27 2010 — edited Jul 20 2010
JDEV 11gR1PS1

Hi all,

I'm writing a Java class that posts via HTTPS. I'm getting the the following error when executing the class:

java.lang.ClassCastException: weblogic.net.http.SOAPHttpsURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection

using the following code (just a snip of what's relevant:
            url = new URL(nurl);
            connection = (HttpsURLConnection)url.openConnection();
            responseCode = connection.getResponseCode();
I've also tried based on some research on the web
            url = new URL(null, nurl, new com.sun.net.ssl.internal.www.protocol.https.Handler());
            connection = (HttpsURLConnection)url.openConnection();
            responseCode = connection.getResponseCode();
and instead I this error

java.lang.ClassCastException: com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl cannot be cast to javax.net.ssl.HttpsURLConnection

Ideas?

Comments

orlandok
Import this instead

import weblogic.net.http.SOAPHttpsURLConnection;

and then when attempting the connection try using the SOAPHttpsURLConnection object
1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 17 2010
Added on Apr 27 2010
1 comment
15,813 views