tomcat 之memory leak== registered the jdbc driver com mysql jdbc driver
来源:互联网 发布:什么是图形化编程 编辑:程序博客网 时间:2024/06/06 13:11
异常如下:
2012-2-9 17:43:12 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/codeMarket] registered the JBDC 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.
2012-2-9 17:43:12 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/codeMarket] registered the JBDC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2012-2-9 17:43:12 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/codeMarket] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak.
2012-2-9 17:43:12 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
严重: The web application [/codeMarket] created a ThreadLocal with key of type [null] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@e1666]) and a value of type [Java.lang.Object[]] (value [[Ljava.lang.Object;@e0ada6]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
2012-2-9 17:43:12 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
严重: The web application [/codeMarket] created a ThreadLocal with key of type [null] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@a8a314]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@16ab2e8]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
AbandonedObjectPool is used (org.apache.commons.dbcp.AbandonedObjectPool@11f1f12)
LogAbandoned: false
RemoveAbandoned: true
RemoveAbandonedTimeout: 3600
搜了一堆资料终于搞懂了 赶紧记下来~~
第一个问题:
严重: The web application [/codeMarket] registered the JBDC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
------------------------------------------------------------------------------------------------------------------------------------------------------
原因如下:
应用程序注册了JDBC驱动,但当程序停止时无法注销这个驱动,tomcat为了防止内存溢出,就给强制注销了
https://issues.apache.org/jira/browse/DBCP-332
由于JDBC连接池用的是dbcp,dbcp1.3/1.4连接池没有自动的去回收空闲连接的功能,在1.3.1、1.4.1版本做了修复 (可以替换成新版本试试,亦可以按以下方案重写,也可以考虑使用c3p0,它有自动回收空闲连接功能)
-------------------------------------------------------------------------------------------------------------------
解决:
重写了org.apache.commons.dbcp.BasicDataSource 的 close()方法:
package org.company.util;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.apache.commons.dbcp.BasicDataSource;
public class XBasicDataSource extends BasicDataSource{
@Override
public synchronized void close() throws SQLException{
// System.out.println("......输出数据源Driver的url:"+DriverManager.getDriver(url));
DriverManager.deregisterDriver(DriverManager.getDriver(url));
super.close();
}
}
。。。
在dbcp数据源中的配置:
<bean id="myDataSource"
class="org.company.util.XBasicDataSource" destroy-method="close">
<property name="driverClassName"
value="oracle.jdbc.driver.OracleDriver">
</property>
<property name="url"
value="jdbc:oracle:thin:@XX.XXX.XX.X:1521:ccdb">
</property>
<property name="username" value="codemanage"></property>
<property name="password" value="codemanage"></property>
<property name="maxActive" value="10"></property>
<property name="initialSize" value="5"></property>
<property name="removeAbandoned" value="true"></property>
<property name="removeAbandonedTimeout" value="3600"></property>
</bean>
问题解决~
-------------------------------------------------------------------------------------------------------------
第二个问题
再重新加载的时候发现还有:
严重: The web application [/codeMarket] registered the JBDC 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.
2012-2-9 17:43:12 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
检查了一下jar包 发现多了一个mysql-connector-java-bin.jar 因为我用的是oracle 但是把mysql和oracle的jar包都加进去了 删掉即可 ok~
-----------------------------------------------------------------------------------------------------------------
补充参考:
http://wy649898543.iteye.com/blog/1440165
- tomcat 之memory leak== registered the jdbc driver com mysql jdbc driver
- tomcat 启动报错 registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister
- tomcat 问题 registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister
- 严重: The web application [/] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregis
- The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister i
- The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister
- S2SH The web application[] registered the JDBC driver [com.mysql.jdbc.Driver] bur failed to unreqist
- registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it
- 使用DBCP出现registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it
- tomcat The web application [/zzti] registered the JDBC driver [com.microsoft.sqlserver.jdbc.SQLServe
- Tomcat7 registered the JDBC driver [com.microsoft.sqlserver.jdbc.SQLServerDriver]
- registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web applica问
- SpingMVC registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the we
- 【解决Tomcat启动异常】To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
- tomcat启动,报问题:To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
- tomcat 启动时报错:To prevent a memory leak, the JDBC Driver has been forcibly unregistered
- [tomcat 8.0.47]To prevent a memory leak, the JDBC Driver has been forcibly unregistered
- application registered the JDBC driver [com.mysql] but failed to unregister it when the web app...
- 解决Tap手势和UITableView点击冲突
- 这里有一份面筋请查收(七)
- vps centos6搭vpn
- 函数后面 加上const
- Git工作流程
- tomcat 之memory leak== registered the jdbc driver com mysql jdbc driver
- java CountDownLatch使用
- binsearch 函数的解释说明。
- map使用方法更新
- C++类中的static数据成员,static成员函数
- MySql之分页优化
- java内存模型:volatile变量、与synchronized
- 【译】你想知道的关于JavaScript作用域的一切
- java中的原子操作类AtomicInteger及其实现原理