Solved

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

Posted on 2012-04-12
9
7,064 Views
Last Modified: 2012-04-17
Hi Experts,

i am facing a problem please help me, my problem, i have to connect another server, get response code and based on the response code redirect it to ther website or error page, my code was working fine for http site, now i need to do the same thing for HTTPS site but i am getting the below error :

i have seen the simillar question on this site but i followed the same still i am getting this error, actually i tried disabling the certificate verification by using "TrustManager" but still throwing the same error.

The error is thrown on this line :
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();

i have attached the java file, please have a look and let me know the solution.
if you have a example code please provide me.

Error :
java.lang.ClassCastException: weblogic.net.http.SOAPHttpsURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection
0
Comment
Question by:quickjava
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 36

Accepted Solution

by:
mccarl earned 500 total points
ID: 37840508
The error is because 'weblogic.net.http.SOAPHttpsURLConnection' does not extend from 'javax.net.ssl.HttpsURLConnection', as the error message is implying.

Do you need to call any methods of 'javax.net.ssl.HttpsURLConnection'? If not just cast the connection as 'java.net.HttpURLConnection' instead (as that IS a superclass) and you should be right!
0
 

Author Comment

by:quickjava
ID: 37840536
Hi,

I tried this

Intead of  this : URL url = new URL(fURL);

i tried with this :  java.net.URL wsURL = new URL(null, fURL,new n.net.www.protocol.https.Handler());

and now i am getting this  error :
javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No X509TrustManager implementation available

Please help me
0
 
LVL 36

Expert Comment

by:mccarl
ID: 37840571
Did you try what I mentioned above?

For that second error message, did you get that at the ... new URL(...) line or does it throw that error later when you are actually trying to use the connection?
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Closing Comment

by:quickjava
ID: 37843636
Thanks it is working perfectly  with these two combination :

java.net.URL url = new URL(null, fURL,new sun.net.www.protocol.https.Handler());
java.net.HttpURLConnection  connection = (HttpsURLConnection) url.openConnection();
0
 
LVL 36

Expert Comment

by:mccarl
ID: 37845295
Glad to hear it is working! Cheers
0
 

Author Comment

by:quickjava
ID: 37852573
Hi, i am facing some other problem, it is working when i just pass "https://staging.energyguidedev.com",  but when i pass the query parameters like below it is not working, tried with encoding the URL and got "MalformedURLException" exception, if i try without encodeingURL it just trys for long time and gives connection timeout error, i am not sure but thinking it may be because of SSL cetificate, if it is SSL related could you please let me know the steps to add the SSL in my server.  



https://staging.energyguidedev.com/customercare/ccssentry.aspx?sid=174&referrerid=101&customerid=0064050900&SessionGUID=UugL5AGJAGz3Cyi4CKc jNRdDhYImgco

Thanks
0
 
LVL 36

Expert Comment

by:mccarl
ID: 37854069
I would doubt that it is SSL related because as far as I know the certificate applies to the site as a whole, so if it works without the query parameters, I don't think that would be it.

Is this a site that you normally have to login to access these pages? Maybe that SessionGUID is no longer valid by the time you are trying to access it.

Actually, looking it again, you say that this is your server? You should be able to debug on the server side why the connection times out?
0
 

Author Comment

by:quickjava
ID: 37858673
Thanks for your reply, tried checking it in the log but is not showing any error except timeout.
i am also thinking the same, the SessionID is getting invalide when i connect to the server,  i am not hunderstanding how to maintain valid sessionID.

if there is anyway of maintaining the valid sessionID please let me know.
0
 
LVL 36

Expert Comment

by:mccarl
ID: 37859191
I asked this previously....

> Is this a site that you normally have to login to access these pages?

If so, then you may have to get your code to follow the same login procedure in order to get a valid SessionID.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question