> > -----Original Message----- > From: David kerber [mailto:dcker...@verizon.net] > Sent: Thursday, February 12, 2015 9:40 AM > To: Tomcat Users List > Subject: Re: tomcat severe error when shutting down service but > startup is clean > > On 2/12/2015 9:06 AM, Wirth, Kevin wrote: >> I keep getting these weird tomcat errors on shutdown on a newly built system >> using tomcat 7.0.57 on a windows 2012 server with jdk 1.7 that I can't >> figure out. This is the catalina log: >> Feb 12, 2015 8:54:31 AM org.apache.catalina.loader.WebappClassLoader >> clearReferencesJdbc >> SEVERE: The web application [/identityiq] registered the JDBC driver >> [com.microsoft.sqlserver.jdbc.SQLServerDriver] but failed to unregister it >> when the web application was stopped. To prevent a memory leak, the JDBC >> Driver has been forcibly unregistered. >> Feb 12, 2015 8:54:31 AM org.apache.catalina.loader.WebappClassLoader >> clearReferencesThreads >> SEVERE: The web application [/identityiq] appears to have started a thread >> named [Thread-3] but has failed to stop it. This is very likely to create a >> memory leak. > DK> I ran into this a while back, and it means exactly what it says: the db driver is being registered (loaded), but not being unloaded. I fixed it by putting the db driver unload commands in a contextDestroyed method.
cb> David cb> cb> I have the same issue as Kevin. What "unload commands" code did you call in the contextDestroyed method? Are those methods "universal"? The reason I ask is because we use different ODBC drivers for different environments. DK> I call this code from my .contextDestroyed method (I didn't write it, I copied it from somewhere on the web): DK> public static void unRegisterDrivers() { DK> try { DK> for ( Enumeration<Driver> drivers = DriverManager.getDrivers(); DK> drivers.hasMoreElements(); ) { DK> DriverManager.deregisterDriver( drivers.nextElement() ); DK> } DK> } catch ( Exception e ) { DK> /* log the exception */ DK> } DK> } Thanks David! That solved this error message: <message> org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc SEVERE: The web application [/irma] registered the JDBC driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. </message> However, the one below still occurs, which I don't understand. Is it saying that an instance of an object was created outside of java garbage collection control that is not being released? <message> org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SEVERE: The web application [/irma] created a ThreadLocal with key of type [com.microsoft.sqlserver.jdbc.ActivityCorrelator$1] (value [com.microsoft.sqlserver.jdbc.ActivityCorrelator$1@dc160cb]) and a value of type [com.microsoft.sqlserver.jdbc.ActivityId] (value [de6bd261-6408-4336-86e2-375848be61b5-5]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak. </message> In the contextDestroyed listener method I added [System.out.println(String.valueOf(driver));] to try to get more info, but I'm not sure it provided anything meaningful: <log> sun.jdbc.odbc.JdbcOdbcDriver@49f4bcf7 SQLServerDriver:1 </log> > >> >> The jdbc driver I am using is in the folder identityiq under the webapps >> directory in tomcat. It is the sqljdbc4.jar driver. This driver is not in >> the tomcat\lib directory. Please help because I am getting no help from the >> vender. Thank you. >> >> Kevin Wirth >> [...] >> -- Cris Berneburg, Lead Software Engineer CACI, IRMA Project, 703-679-5313 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org