NutzCN Logo
问答 使用druid连接池连接mysql,tomcat关闭的时候报可能导致内存泄露
发布于 2621天前 作者 qq_c54e87f6 5024 次浏览 复制 上一个帖子 下一个帖子
标签:

18-Sep-2017 15:16:54.419 INFO [localhost-startStop-2] com.alibaba.druid.pool.DruidDataSource.info {dataSource-1} closed
18-Sep-2017 15:16:54.463 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
18-Sep-2017 15:16:54.463 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] 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.
18-Sep-2017 15:16:54.467 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] 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. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:40)
18-Sep-2017 15:16:54.573 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-apr-8080"]
18-Sep-2017 15:16:54.628 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-apr-8009"]
18-Sep-2017 15:16:54.680 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-apr-8080"]
18-Sep-2017 15:16:54.682 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-apr-8009"]
Disconnected from server

以下为dao.js的配置文件
{
defaultDao : {
type : "org.nutz.dao.impl.NutDao",
args : [{refer:"dataSource"}]
},
dataSource : {
type : "com.alibaba.druid.pool.DruidDataSource",
events : {
depose : 'close'
},
fields : {
url : 'jdbc:mysql://localhost:3306/coderule',
username : 'root',
password : 'root',
defaultAutoCommit : false,
maxWait: 15000
}
}
}

6 回复

用“插入代码”按钮重新贴一次

18-Sep-2017 15:16:54.419 INFO [localhost-startStop-2] com.alibaba.druid.pool.DruidDataSource.info {dataSource-1} closed
18-Sep-2017 15:16:54.463 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
18-Sep-2017 15:16:54.463 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] 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.
18-Sep-2017 15:16:54.467 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] 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. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
 com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:40)
18-Sep-2017 15:16:54.573 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-apr-8080"]
18-Sep-2017 15:16:54.628 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-apr-8009"]
18-Sep-2017 15:16:54.680 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-apr-8080"]
18-Sep-2017 15:16:54.682 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-apr-8009"]
Disconnected from server

以下为dao.js配置:

{
   defaultDao : {
                type : "org.nutz.dao.impl.NutDao",
                args : [{refer:"dataSource"}]
        },
    dataSource : {
        type : "com.alibaba.druid.pool.DruidDataSource",
        events : {
            depose : 'close'
        },
        fields : {
            url : 'jdbc:mysql://localhost:3306/coderule',
            username : 'root',
            password : 'root',
            defaultAutoCommit : false,
            maxWait: 15000
        }
    }
}

@wendal 好的 谢谢

来自炫酷的 NutzCN

@wendal
弱弱的问一句,这个看懂了,我该怎么解决呀,,😂

来自炫酷的 NutzCN

... 加到你自己的Setup.destory方法啊

添加回复
请先登陆
回到顶部