Solved

java.net.URLConnection.connect()

Posted on 2006-07-13
9
480 Views
Last Modified: 2008-01-09
hi guys,

I'm working on a new project.

I'm trying to find out about connection timeout exception. I've set the timeout of the connection to a limit, but weblogic does not accept it. It still referred to its xml file for its timeout period. I'm trying to resolve this by testing all possibities of getting/setting a timeout period.

At my side, I tried getting my program to connect to a non-existent website, and get "unknown host" error, whcih is logical. Is there any way I can test the SocketTimeoutException error?

umm... i think my topics are pretty messy...
0
Comment
Question by:java_kevin
[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
  • 4
  • 4
9 Comments
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17105614
How are you setting socket timeout in URLConnection?
0
 

Author Comment

by:java_kevin
ID: 17105946
URL url = new URL(targetURL);
connection = (HttpURLConnection)url.openConnection();
connection.setTimeout(300000);
try {
connection.connect();
....
}

catch (SocketTimeoutException e) {
...
}

====================

HttpURLConnection is a method that implements the abstract method from java's java.net.HttpURLConnection.
http://edocs.bea.com/wls/docs81/javadocs/weblogic/net/http/HttpURLConnection.html
0
 
LVL 35

Expert Comment

by:girionis
ID: 17106149
What version of WebLogic are you using? If >= Weblogic 9.0 then use setReadTimeout(int)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

Expert Comment

by:girionis
ID: 17106154
Ok you are using 8.1, still, try to use setReadTimeout(int)
0
 

Author Comment

by:java_kevin
ID: 17135267
umm, gosh, There is a difference between WebLogic 8.1 SP2 and SP6!

SP6 seems to provide setReadTimeout, while SP2 is still using setTimeout.

And accordingly to http://e-docs.bea.com/wls/docs81/notes/resolved_sp03.html, setTimeout feature in SP2 seems buggy.

For SP2, http://e-docs.bea.com/wls/docs81/notes/resolved_sp02.html, nothign was mentioned.

Any idea where I can get API documentation for weblogic 8.1 SP2? ;)
0
 
LVL 35

Expert Comment

by:girionis
ID: 17136230
Can you upgrade to sp6?
0
 

Author Comment

by:java_kevin
ID: 17136421
No plans to do so at the moment.

But is this a bug? I mean, I can't really grasp the exact meaning it's trying to pass.

Does it mean, the calling of the method will be delayed, or it really refers to the value accepted by the method will be doubled?
0
 
LVL 35

Accepted Solution

by:
girionis earned 125 total points
ID: 17136441
Yes it's a bug in the implementation of setTimeout. It means that the time taken for the timout to occur is double. I.e. if you set the timeout to 1000, it will take 2000 before it times out. Well, if it is so, then the only thing you have to do is to set half the time out of the required amount.
0
 

Author Comment

by:java_kevin
ID: 17136481
oh.. that's... why..

alright, i'm asking the BEA side for an official confirmation of this issue, before I proceed to change the code again.

Will check back here again!
0

Featured Post

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

Question has a verified solution.

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

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

751 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