I am using Tomcat 6.0.29 and the Derby embedded driver 10.5.3 and JDK 1.6.0_18. When I shutdown Tomcat, I get the following errors in the catalina.log file:

 

SEVERE: The web application [/MyApp] registered the JBDC driver [org.apache.derby.jdbc.AutoloadedDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

SEVERE: The web application [/MyApp] created a ThreadLocal with key of type [org.apache.derby.iapi.sql.dictionary.TableDescriptor$1] (value [org.apache.derby.iapi.sql.dictionary.TableDescriptor$1@d133a3]) and a value of type [java.util.WeakHashMap] (value [{={1, 2, 3, 4}, =null, =null}]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.

 

I found a reference to these errors in this issue report:

 

https://issues.apache.org/jira/browse/DBCP-332

 

But they are related to the BasicDataSource.close() and Spring. I am not using BasicDataSource.

 

I connect to the database as follows:

 

          Class.forName("org.apache.derby.jdbc.EmbeddedDriver");

          String connectionURL = "jdbc:derby:" + databaseName + ";create=true";

          Connection conn = DriverManager.getConnection(connectionURL);      

               

                           conn.close();

 

On application shutdown, I shut the Derby system down as follows:

 

                    DriverManager.getConnection("jdbc:derby:;shutdown=true");

 

I have no open connections that would cause this.

 

Has anyone seen this issue with the embedded driver?

 

Thanks