Mysteriously closed connection

While deploying our product to our stage environment, we found a “glitch” with our Java webapp. We’re using Tomcat 5.0.27, Hibernate 2.1.7c, RHEL 4 and Oracle. I’m seeing this wonderful error:

WARN  net.sf.hibernate.util.JDBCExceptionReporter - SQL Error: 17008, SQLState: null
ERROR net.sf.hibernate.util.JDBCExceptionReporter - Closed Connection

Followed by:

ERROR com.mycompany.SomeObjectFactory - HibernateException trying to commit: com.mycompany.SomeObjectImpl
net.sf.hibernate.exception.GenericJDBCException: Could not save object
Caused by: java.sql.SQLException: Closed Connection
        at oracle.jdbc.dbaccess.DBError.throwSqlException( Code))

I’ve looked through the code and used a logging jdbc driver (which wraps the actually jdbc driver
and logs statements for certain objects.) to log the Connection. No close() method was called. So
from what I can gather our application isn’t closing it by accident. But I can’t figure out what
is closing the connection.

I’ve already checked Oracle and it is not set to close idle connections.
Checked the router between the DB and the application box.
The closest I can fathom is the kernel’s tcp_keepalive_time which is set to 7200 (which is approximately
when we see the above error occur).

We’ll continue our investigation, but this is indeed a perplexing problem.


2 thoughts on “Mysteriously closed connection

  1. dump hibernate and write your own darn db framework. that way you know how everything works. oss frameworks are crutches that will keep you limping along forever.

  2. some time firewall cut connection, if you have a pool with a minimun connection pool is more than zero after an inactivity period firwall can close you connection
    hope it helps

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s