当我们尝试取消部署应用程序时,一些Oracle类似乎正在泄漏.我在使用旧的ojdbc14.jar驱动程序时没有看到这一点,但我们无法使用这些驱动程序,因为我们正在迁移到需要更新驱动程序的Oracle 11g.我猜这是Oracle驱动程序中的一个错误?有什么办法可以清理这些资源吗?我试过关闭数据库连接池和其他东西无济于事……
不使用Tomcat的连接池会更好吗?我们宁愿让服务器连接到数据库,但如果有必要,我们可以自己做…
Server控制台显示:
17505 INFO org.springframework.orm.jpa.LocalContainerEntityManagerfactorybean – Closing JPA EntityManagerFactory for persistence unit ‘myManager’
17515 INFO org.apache.tiles.access.TilesAccess – Removing TilesContext for context: org.springframework.web.servlet.view.tiles2.SpringTilesApplicationContextFactory$SpringWildcardServletTilesApplicationContext
Dec 06,2012 6:41:29 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/myApp] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@1468544]) and a value of type [java.lang.Class] (value [class oracle.sql.AnyDataFactory]) but Failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Dec 06,2012 6:41:29 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/myApp] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@d73b31]) and a value of type [java.lang.Class] (value [class oracle.sql.TypeDescriptorFactory]) but Failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Dec 06,2012 6:41:29 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/myApp] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@13aae39]) and a value of type [java.lang.Class] (value [class oracle.sql.TypeDescriptorFactory]) but Failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Dec 06,2012 6:41:29 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/myApp] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@18443b1]) and a value of type [java.lang.Class] (value [class oracle.sql.AnyDataFactory]) but Failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Dec 06,2012 6:41:34 PM org.apache.catalina.startup.HostConfig deleteRedeployResources
INFO: Undeploying context [/myApp]
我已经尝试添加ContextListener手动关闭我们的DBCP连接,但这没有帮助.
InitialContext initial = new InitialContext(); DataSource ds = (DataSource) initial.lookup("java:/comp/env/jdbc/myDS"); if (ds.getConnection() == null) { throw new RuntimeException("I Failed to find the datasource"); } LOG.debug("Found datasource. Closing..."); BasicDataSource bds = (BasicDataSource) ds; bds.close();