File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpURLConnection.connect() times out, while wget works fine

 
Ruben Matthews
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Java friends

I have a problem where an application I am working on is throwing the following exception "java.net.ConnectException: Connection timed out" after trying to connect() to a URI.



This small test case outputs

YEEEEHAAAAH
test1

and then stalls....



I tried to "wget" the url from the box the application is running on and that works fine. It returns 200 OK. So, the url is accessible, but still connect() times out.

Any clue why?
 
Ruben Matthews
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just talked to our network admin and he explained to me it is caused by the fact that the application (tomcat) is not going through the proxy. Problem is solved.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47300
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well done solving it, and thank you for giving a solution; it will be helpful if anybody else has a similar problem ever.
 
Rob Spoor
Sheriff
Pie
Posts: 20396
47
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a good thing URL has an openConnection(Proxy) method
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic