Venky's Blog

Just another WordPress.com weblog

Using javax.net.ssl.HttpsUrlConnection in weblogic server


All,

When you deploy a Java Code using java.net.URL object in weblogic server, on opening a connection using URL object, instead of getting the standard javax.net.ssl.HttpsUrlConnection it will return weblogic.net.http.SOAPHttpsURLConnection

Even if you try to type cast it, you will get class cast exception as these 2 classes are not compatible. You may not like to use the weblogic.net.http.SOAPHttpsURLConnection class also as the method signature is different

To overcome the issue, a simple replacement of the code below would work

Instead of creating a URL object using standard constructor like

URL wsURL = new URL(wsLoc + “?command=login”);

Use

java.net.URL wsURL = new URL(null, wsLoc + “?command=login”,new sun.net.www.protocol.https.Handler());

About these ads

14 comments on “Using javax.net.ssl.HttpsUrlConnection in weblogic server

  1. Dev
    October 8, 2010

    The above code does solve the ClassCastException problem in WebLogic. It helped me in a situation where I needed to make a thin web service client to connect to a Client cert authenticated SSL web service interface on WebLogic 9.2. The bad side is that if the System-wide SSL provider changes, the code will most likely break, since it is dependent on the SUN’s implementation.

  2. Chris Love
    November 11, 2010

    Thanks a ton. This helped!!

  3. Pingback: web proxy|glype proxy|anonymous proxy|firewall proxy

  4. Pingback: host plus

  5. Steve
    March 12, 2012

    Thanks for this really valuable tip!

  6. chris
    March 30, 2012

    thanks!

  7. Jackie Liu
    April 12, 2012

    thx u so much!!! It’s really valuable…

  8. http://gameshack.projects.si.umich.edu/elgg2/pg/profile/PrestonStancil
    December 15, 2012

    Howdy would you mind stating which blog platform you’re working with? I’m looking to start my own blog soon but I’m having a tough time selecting between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I’m looking for something completely unique.

    P.S Sorry for being off-topic but I had to ask!

    • Venkatesan Sundaram
      January 3, 2013

      Hi, It is wordpress

  9. Srinivasan
    May 28, 2013

    Thanks. This actually had solved a very big issue for me. thanks a lot again

  10. toshima66
    July 8, 2013

    Thanks!

  11. Niels J Nielsen
    October 30, 2013

    I spent a day trying to solve this problem. Thanks !!!

  12. Larry Anderson
    January 21, 2014

    This helped me out, thanks for your post!

  13. siva
    April 1, 2014

    awesome fix …

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on March 4, 2009 by in SaaS.
Follow

Get every new post delivered to your Inbox.

Join 38 other followers

%d bloggers like this: