• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic