转:http://blog.csdn.net/snoopy93/article/details/6800660
今天tomcat 6遇到两个错误提示:
1.
严重: A web application 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.

原因:重复加载了jar包。
解决方法:原来我在tomcat的lib文件夹放入了com.mysql.jdbc.Driver的jar包,而又在项目里面重复添加了,导致了上面的提示。删掉其中一个解决问题。

2.The web application [/snoopy] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@ea85b4]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@efeff8]) 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.

原因:tomcat 6.026之后的版本加入了 memory leak detection feature(内存泄露检查)看如下原文:
There is a memory leak detection feature introduced in Tomcat 6.0.26 that attempts to log objects that have failed to be unregistered by webapps it hosts when they are stopped, and were forcibly unregistered by Tomcat. As Tomcat is forcibly removing these objects, it is not a serious concern that these log messages occur.

解决方法:在tomcat 的server.xml文件中将注释掉即可
PS:这是一个治标不治本的方法。

***********************************

解决 ”To prevent a memory leak, the JDBC Driver has been forcibly unregistered“

  • 博客分类:
  • 项目总结

在开发过程中,添加完UrlWriter之后,部署到了服务器环境,发生了如下错误

Java代码  
  1. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

原来Tomcat6会起一个线程检测是否有内存泄露

写道
Ignore those warnings. Tomcat is doing its job right. The actual bug is in someone else's code (the JDBC driver in question), not in yours. Be happy that Tomcat did its job properly and wait until the JDBC driver vendor get it fixed so that you can upgrade the driver.

Downgrade to Tomcat 6.0.23 or older so that you will not be bothered with those warnings. But it will silently keep leaking memory. Not sure if that's good to know after all. Those kind of memory leaks are one of the major causes behind OutOfMemoryError issues during Tomcat hotdeployments.

Move the JDBC driver to Tomcat's /lib folder and have a connection pooled datasource to manage the driver. Note that Tomcat's builtin DBCP does not deregister drivers properly on close. See also bug DBCP-322. The DBCP project is however currently stalling. I wouldn't expect quick updates. You would rather like to replace DBCP by another connection pool which is doing its job better then DBCP. For example BoneCP or Tomcat JDBC Pool maybe?

解决办法有两个

1) 将UrlWirter的Filter从web.xml中去掉或者重写destory方法

2) 将Mysql的驱动包复制一份到Tomcat的Lib目录下

困扰老子好久啊!!tomcat的两个错…相关推荐

  1. java 不重启部署_编译Java类后不重启Tomcat有两种方式:热部署、热加载

    不重启Tomcat有两种方式:热部署.热加载 热部署:容器状况在运行时重新部署整个项目.这类环境下一般整个内存会清空,重新加载,这类方式 有可能会造成sessin丢失等环境.tomcat 6确实可以热 ...

  2. 启动两个tomcat,两个端口,两个tomcat都启动时回显示端口被占用

    启动两个tomcat,两个端口,两个tomcat都启动时回显示端口被占用,如图下 步骤: 使用两个tomcat,其中一个可以默认不修改 对另外一个tomcat,打开conf下的server.xml文件 ...

  3. tomcat执行shutdown报错Could not contact [localhost:8005] (base port [8005] and offset [0]). Tomcat may n

    学习笔记 困扰了好久的问题,每次重启tomcat执行shutdown就报错Could not contact [localhost:8005] (base port [8005] and offset ...

  4. DRP问题集结(一)-Tomcat无法启动,报错java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory...

    问题一:  Tomcat无法启动,报错java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory 问题二:[Error]Jav ...

  5. Eclipse正确配置Tomcat之后仍然报错Type Target runtime Apache Tomcat v8.0 is not defined解决方式

    Eclipse正确配置Tomcat之后仍然报错Type Target runtime Apache Tomcat v8.0 is not defined解决方式 虽然项目能正常运行,但是看着这个红叉叉 ...

  6. linux安装tomcat后启动报错Cannot find ./catalina.sh的解决方法

    linux安装tomcat后启动报错: Cannot find ./catalina.sh The file is absent or does not have execute permission ...

  7. Linux下Tomcat项目启动报错

    Linux下Tomcat项目启动报错 org.springframework.beans.factory.CannotLoadBeanClassException: Error loading cla ...

  8. Tomcat无法启动,报错java.lang.NoClassDefFoundError: or...

    今天使用Tomcat 7 时,发现Tomcat无法启动, 报错java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory 以为 ...

  9. Tomcat中两个不同项目共享Session

    本文研究的是同一个Tomcat目录下的两个不同的应用共享同一个session.由于每个WEB应用程序都有一个唯一的一个ServletContext实例对象,本应用中的所有的servlet共享此Serv ...

最新文章

  1. Sharding-jdbc教程:Mysql数据库主从搭建
  2. clickhouse 航空数据_趣头条基于Flink+ClickHouse的实时数据分析平台
  3. 周例会会议、汇报框架
  4. 云顶之弈服务器维修,云顶之奕云服务器
  5. 51CTO博客移动化意味着什么?IT博主可以搞事情了!
  6. 什么是抽象类?抽象类的作用_揭秘!Java 泛型背后到底是什么?
  7. Android之android.os.Build
  8. 朱艳梅Java_基于CNKI的大学Java程序设计教学改革文献计量分析
  9. 平面/UI设计师社区交流网站集设|给你的作品多一个展示机会
  10. Transformer提效之路干货笔记——一文梳理各种魔改版本Transformer
  11. 软考_2021年11月真题2__三点估算技术
  12. 读后感----我奋斗了18年还是不能和你坐在一起喝咖啡
  13. 操作系统 内存分配-分区
  14. linux修改shell前缀,Linux shell控制台改变显示前缀
  15. [办公自动化]目录修改以及插入分页符后行间距自动变宽
  16. 使用VLAN隔离虚拟机流量
  17. 3D建模:14个建模小技巧
  18. 040-云E办_学习和安装FastDFS以及安装Nginx
  19. Python并发编程之线程的玩法
  20. STM32L4系列单片机ADC通过内部参考电压精确计算输入电压

热门文章

  1. 乔恩·斯凯特(Jon Skeet)-编程的查克·诺里斯(Chuck Norris)
  2. Agent系列(一) 什么是Agent
  3. win7的远程桌面连接在哪
  4. 雨天在火车站台上撑伞会触电吗?
  5. getMonth()函数的问题
  6. 关于CSDN获取博客内容接口的x-ca-signature签名算法研究
  7. 设置java 环境变量
  8. Element Ui之利用sort-change事件及sortable属性实现Table表格指定列的排序
  9. 中国超2亿人单身,一线城市单身青年4成月光
  10. 柏拉图對愛與婚姻得啟示---------捷徑穿越人生得麦田