用C3P0做数据库连接池,在Tomcat运行项目中运行项目,出现了貌似内存泄露的问题,很困扰,请大神指点

2014-9-2820:21:35org.apache.catalina.loader.WebappClassLoaderclearReferencesJdbc严重:Th... 2014-9-28 20:21:35 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/JavaWebAuthority] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2014-9-28 20:21:35 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/JavaWebAuthority] appears to have started a thread named [Timer-1] but has failed to stop it. This is very likely to create a memory leak.
2014-9-28 20:21:35 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/JavaWebAuthority] appears to have started a thread named [C3P0PooledConnectionPoolManager-Helper Thread-#0] but has failed to stop it. This is very likely to create a memory leak.
2014-9-28 20:21:35 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/JavaWebAuthority] appears to have started a thread named [C3P0PooledConnectionPoolManager-Helper Thread-#1] but has failed to stop it. This is very likely to create a memory leak.
2014-9-28 20:21:35 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/JavaWebAuthority] appears to have started a thread named [C3P0PooledConnectionPoolManager-Helper Thread-#2] but has failed to stop it. This is very likely to create a memory leak.
2014-9-28 20:21:35 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/JavaWebAuthority] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
当我第一次发布时没有问题,在浏览器里面点几下,然后再次发布就会出现上面的严重消息,我的财富值不够了,希望能帮我解决啊,
展开
 我来答
匿名用户
2014-09-29
展开全部

我觉得是jdbc无法关闭,所以tomcat强制关闭导致的,据说这是basicdatasource的bug可以重写一下close方法

public class XBasicDataSource extends BasicDataSource {
    @Override
    public synchronized void close() throws SQLException {
        DriverManager.deregisterDriver(DriverManager.getDriver(url));
        super.close();
    }
}
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式