Elma Snyman <elma.sny...@sas.com> writes:

> 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.

This could be DERBY-2905.

> 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.tabledescripto...@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.
>

The Derby engine uses a thread local variable
TableDescriptor#referencedColumnMap, which contains a weak hash map
object. It seems the weak hash map object is still there when Derby has
shut down. Since it's weak (referenced objects will be garbage collected
once Derby has shut down) it is not likely to cause much of a memory
leak, but I'll file a bug for this.

Dag

> 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
>

-- 

Reply via email to