Solved

java.net.URLConnection.connect()

Posted on 2006-07-13
9
448 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
  • 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
 
LVL 35

Expert Comment

by:girionis
ID: 17106154
Ok you are using 8.1, still, try to use setReadTimeout(int)
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countX 22 70
Requested array size exceeds VM limit 3 51
Java and GPO 11 47
thymeleaf natural templating vs JSP 2 30
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now