Solved

java.net.URLConnection.connect()

Posted on 2006-07-13
9
458 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Starting to learn JAVA, 7 59
Java asynchronous logging 4 50
Java and GPO 11 71
Java Loop 6 49
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…
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…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

896 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