This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Strange prob with communication between co-located web apps - SocketTimeoutException: Read timed out Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Strange prob with communication between co-located web apps - SocketTimeoutException: Read timed out" Watch "Strange prob with communication between co-located web apps - SocketTimeoutException: Read timed out" New topic
Author

Strange prob with communication between co-located web apps - SocketTimeoutException: Read timed out

James Hodgkiss
Ranch Hand

Joined: Jan 22, 2004
Posts: 401
Hiya,

We have a front end Java web app, and a back end Java web app. The front end web app makes requests (using HttpURLConnection) from the back end web app.

When the two web apps are located on different servers, everything is fine. However, when we put them on the same server, we are getting "SocketTimeoutException: Read timed out" when we have 5 or more simultaneous HttpURLConnections.

We're using the GlassFish container (glassfish-installer-v2.1.1-b31g-linux.jar), but don't have much idea what the problem is. Here is our HttpURLConnection code used in the front end web app...



...as you can see, the method returns a HttpURLConnection, but that connection is always closed (in a 'finally' block), so what could the problem be?

I'm going to try putting this code in a new Thread but, apart from that, does anyone have any ideas, suggestions or explanations?!

Thanks in advance,
James
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I know when I use Websphere, the default is to disallow outbound socket connections, and it's necessary to include a policy file with the web application if it has to do that. Quite possibly that's a standard Java EE rule and you would have to do the same sort of thing with your Glassfish installation.

Unfortunately I haven't used Glassfish so I couldn't start to tell you how to do that, if indeed that's your problem.
James Hodgkiss
Ranch Hand

Joined: Jan 22, 2004
Posts: 401
Hiya Paul,
The outbound connections are fine - it's when the connections are made to localhost that we have the problem... but the problem only occurs when there are 6 or more simultaneous requests to localhost...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Strange prob with communication between co-located web apps - SocketTimeoutException: Read timed out
 
Similar Threads
Chinese / English encoding problem
post url connection not working
Trying to Redirect. 302 Error. HTTP CLIENT
HttpURLConnection woes!
Connecting to the webserver from simple java program with main method