users@glassfish.java.net

Glassfish DB connection pool closed the idle connection

From: <forums_at_java.net>
Date: Fri, 19 Nov 2010 20:42:41 -0800

 Hi,

I'm using glassfish enterprise v3 for my server using connection pool. It was
fine after it is running for 2 months without any restarting.However, after 2
months, it throws this exception below

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No
operations allowed after connection closed.Connection was implicitly closed
by the driver. at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at
com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at
com.mysql.jdbc.Util.getInstance(Util.java:381) at
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984) at
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926) at
com.mysql.jdbc.ConnectionImpl.throwConnectionClosedException(ConnectionImpl.java:1160)
at com.mysql.jdbc.ConnectionImpl.checkClosed(ConnectionImpl.java:1147) at
com.mysql.jdbc.ConnectionImpl.createStatement(ConnectionImpl.java:2486) at
com.mysql.jdbc.ConnectionImpl.createStatement(ConnectionImpl.java:2468) at
com.mysql.jdbc.jdbc2.optional.ConnectionWrapper.createStatement(ConnectionWrapper.java:515)
at
com.sun.gjc.spi.base.ConnectionHolder.createStatement(ConnectionHolder.java:240)
at
com.sun.gjc.spi.jdbc40.ConnectionWrapper40.createStatement(ConnectionWrapper40.java:71)
at
itwin.revocation.database.AccessDatabase.getDistinctInfoGeneral(AccessDatabase.java:313)
at itwin.revocation.database.ConnMngrDB.getRevokedAssn(ConnMngrDB.java:579)
at
itwin.revocation.utils.RevokedAssnUpdater$DoUpdate.run(RevokedAssnUpdater.java:49)
at java.util.TimerThread.mainLoop(Timer.java:512) at
java.util.TimerThread.run(Timer.java:462) Caused by:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link
failure
It is back to normal after restarting glassfish. But, I'm still curious why
this is happening. I suspect it is because the connection is idle and then
closed, but somehow glassfish failed to remove it from the pool. This cause
this closed connection being reused by the application. Anyone can help?


--
[Message sent by forum member 'guretno']
View Post: http://forums.java.net/node/721211