Thread: Problem with JDBCRealm in Tomcat

Problem with JDBCRealm in Tomcat

From
Håkon Hansen
Date:
Hi!

I'm getting 'Connection reset by peer' and 'Socket closed' errors using
JDBCRealm in a web application running on Tomcat 4.0.3.

I am using RedHat Linux 7.3 and Java 1.4, and connecting to a PostgreSQL 7.2
back-end running remotely on RedHat Linux 7.3. It seems to work fine for a
while, but after a while (typically the next day) the error will occur.

I am using the pgjdbc2.jar JDBC driver, which seemed to be the appropriate one
for my setup. I have looked at the Java source code of this driver, and it
seems that the error occurs within a synchronized block, after the SELECT
statement has been written to the stream (it shows up in the PostgreSQL
server's log, too) and while reading - or trying to read - the response.

Anybody have any clues as to what might be wrong? All help greatly
appreciated!

Yours,

Haakon Hansen
Norway

Re: Problem with JDBCRealm in Tomcat

From
Dave Cramer
Date:
Haakon,

Do you have a firewall between you and the db? It is possible for
firewalls to drop connections if they have been masqueraded, or natted.

Was the db restarted? if so the connection will be dropped.

Dave
On Fri, 2002-07-26 at 09:40, Håkon Hansen wrote:
> Hi!
>
> I'm getting 'Connection reset by peer' and 'Socket closed' errors using
> JDBCRealm in a web application running on Tomcat 4.0.3.
>
> I am using RedHat Linux 7.3 and Java 1.4, and connecting to a PostgreSQL 7.2
> back-end running remotely on RedHat Linux 7.3. It seems to work fine for a
> while, but after a while (typically the next day) the error will occur.
>
> I am using the pgjdbc2.jar JDBC driver, which seemed to be the appropriate one
> for my setup. I have looked at the Java source code of this driver, and it
> seems that the error occurs within a synchronized block, after the SELECT
> statement has been written to the stream (it shows up in the PostgreSQL
> server's log, too) and while reading - or trying to read - the response.
>
> Anybody have any clues as to what might be wrong? All help greatly
> appreciated!
>
> Yours,
>
> Haakon Hansen
> Norway
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
>




Re: Problem with JDBCRealm in Tomcat

From
Håkon Hansen (by way ofHåkon Hansen
Date:
Friday 26 July 2002 16:07:
> Do you have a firewall between you and the db? It is possible for
> firewalls to drop connections if they have been masqueraded, or natted.

I have. This did occur to me, but I did not think it was likely that this was
the case, since it seemed that the error occured during the driver's
execution of the query (since the SELECT statement shows up in the server
log). I am not a tcp/ip or firewall expert though, so I'll pick up on your
suggestion and see where it leads. BTW, there is a part of the server's log
that says that it is reaping dead processes (probably during night) before
the SELECT statement occurs. Would that be an indication that connections
might have been dropped?

> Was the db restarted? if so the connection will be dropped.

Nope.

Yours,

Haakon Hansen
Norway


Re: Problem with JDBCRealm in Tomcat

From
Håkon Hansen
Date:
Friday 26 July 2002 16:07, Dave Cramer wrote:
> Haakon,
>
> Do you have a firewall between you and the db? It is possible for
> firewalls to drop connections if they have been masqueraded, or natted.
>
> Was the db restarted? if so the connection will be dropped.
>
> Dave

Just thought I'd report back that the firewall seems to be the problem. We
tested different configurations, one of them being an Apache HTTPD webserver
outside the firewall, and everything else behind (in the DMZ).

Thanks for your help, Dave!


Yours,

Haakon Hansen
Norway