• Post Reply Bookmark Topic Watch Topic
  • New Topic

Connection timed out issue while accessing URL  RSS feed

 
Gautamaxa roy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  Hi ,

      i am trying to connect the following URL using java code but Exception in thread "main" java.net.ConnectException: Connection timed out: connect is blocking the
      progress. I am able to access the URL from browser in the same machine. Attached Header information details with this post.

       http://www.omdbapi.com/?t=Pagal&i=tt3896198&apikey=6c3a2d45;
          
           My code is as below

              
Header.png
[Thumbnail for Header.png]
 
Tim Moores
Saloon Keeper
Posts: 4034
94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't reproduce the issue - accessing the URL works fine both on the browser and via that Java code, and returns the same JSON.
 
Paul Clapham
Sheriff
Posts: 22832
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's possible that Gautamaxa's browser is using a proxy server to connect to the internet. If that's the case then the Java code isn't using the proxy server and therefore can't connect to the internet at all.

If that's what is happening here, then if I'm not mistaken there are system properties which allow Java code to use a proxy server.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are: http://docs.oracle.com/javase/8/docs/api/java/net/doc-files/net-properties.html#Proxies

You can also specify a proxy in the call to openConnection.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!