users@glassfish.java.net

Re: Strange database closed exception

From: Mitesh Meswani <mitesh.meswani_at_oracle.com>
Date: Wed, 15 Aug 2012 23:35:45 -0700

The connections might have timed out by database due to inactivity. Turn
on connection validation
<https://blogs.oracle.com/JagadishPrasath/entry/connection_validation_in_glassfish_jdbc>
for your pool to check for stale connections.

On 8/15/2012 11:18 PM, John Lister wrote:
> Using glassfish v3.1.2 I repeatedly get the following exception:
>
> Internal Exception: org.postgresql.util.PSQLException: Connection has
> been closed automatically because a new connection was opened for the
> same PooledConnection or the PooledConnection has been closed.
> Error Code: 0
> Call: select data,next from products.word_index_keys where index='book-7'
> Query: DataReadQuery(sql="select data,next from
> products.word_index_keys where index='book-7'")
> class org.eclipse.persistence.exceptions.DatabaseException
>
> Now my code only accesses the db via the connection pool using entity
> managers and eclipselink, so I was wondering if anyone had any
> suggestions as to what or why the connections are being closed in the
> background while in use. I can provide additional info if required.
>
> Thanks
>
> John