Hello, 

I'm running into a problem where I suddenly get "No Connection Exception" 
errors in my application.  This appears to happen after a period of inactivity, 
though it is difficult to assess exactly how much inactivity time has 
transpired because the application is only very lightly used. It is a web 
application, using Tomcat 7 as the web container, with a container managed 
collection pool.  If I simply restart tomcat, the exact same SQL statement 
would then complete with no problems.  When this occurs, the nested exception 
in the stack trace looks like this: 

Caused by: java.sql.SQLNonTransientConnectionException: No current connection.
         at 
org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
         at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
Source)
         at org.apache.derby.client.am.Connection.prepareStatement(Unknown 
Source)
         at sun.reflect.GeneratedMethodAccessor331.invoke(Unknown Source)
         at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:600)
         at 
org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126)
         at $Proxy13.prepareStatement(Unknown Source)
         at 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.prepareStatement(DatabaseAccessor.java:1474)
         at 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.prepareStatement(DatabaseAccessor.java:1423)
         at 
org.eclipse.persistence.internal.databaseaccess.DatabaseCall.prepareStatement(DatabaseCall.java:697)
         at 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:585)
         ... 77 more
Caused by: org.apache.derby.client.am.SqlException: No current connection.
         at 
org.apache.derby.client.am.Connection.checkForClosedConnection(Unknown Source)
         at org.apache.derby.client.am.Connection.prepareStatementX(Unknown 
Source)
         ... 87 more

The only way to clear this up seems to be restarting the web container.   Is 
there some setting in Derby which is causing these connections to go stale?  Is 
there any way to trace this and find out the cause? 

Thanks in advance, 
Tom

Reply via email to