views:

335

answers:

2

Hi all,

I'm facing sort of a strange issue with two applications of mine. Here's the setting:

Two tomcat / java apps, running in the same network, connecting to the same MS-SQL-Server. The one app, which happens to be in an DMZ in order to be accessible from the internet uses to produce "jdbc Connection closed by peer" exceptions in unregular intervals.

Restarting the app in tomcat fixes the problem. The strange things are, that the other app does not have that habit and that all the relevant logs (i.e. Windows Event Log, SQL-Serverlog, Network Monitoring) do not show any problems. Only my app's log's got that connection closed by peer stuff...

I also checked the network settings, the connection has'nt been disrupted in a month. As a last resort I'll restart the whole server tonight and install wireshark on it in order to log the net work traffic...

Does anyone's got another clue what might cause this?

Thx in advance

      K
+1  A: 

What's between your problematic app and the database ? Since it's in a DMZ I suspect you've got a router. If the application keeps a connection open to the database, but that connection is quiet for a period (say, overnight?), then in the absence of traffic, the router may close that connection. I've seen behaviour like this before.

I vaguely remember such a scenario detailed in Release It.

Are you using database pooling, with checks on the connections as they're handed out from the pool ? If the above is the problem, you may want to look at Apache DBCP

Brian Agnew
+1  A: 

Most firewalls (that form the dmz) drop connections that are not active. This issue is very common.

You will have to set your connection pool (min size) to 0 or 1 depending on your appserver. (From memory) WebSphere recommends you set this to 1.

Ryan Fernandes