部署Web应用程序时内存泄漏

时间:2014-09-30 06:03:58

标签: postgresql memory-leaks tomcat6 ubuntu-10.04

org.apache.catalina.startup.HostConfigdeployWAR
INFO:Deployingwebapplicationarchive.war

org.apache.catalina.loader.WebappClassLoadervalidateJarFile
INFO:validateJarFile(/usr/local/tomcat/webapps//WEB-INF/lib/servlet.jar)-jarnotloaded.SeeServletSpec2.3,section9.7.2.Offendingclass:javax/servlet/Servlet.class

AMorg.apache.catalina.loader.WebappClassLoaderclearReferencesJdbc
SEVERE:Thewebapplication[/]registeredtheJDBCdriver[org.postgresql.Driver]butfailedtounregisteritwhenthewebapplicationwasstopped.Topreventamemoryleak,theJDBCDriverhasbeenforciblyunregistered.

org.apache.catalina.loader.WebappClassLoaderclearThreadLocalMap
SEVERE:Thewebapplication[/]createdaThreadLocalwithkeyoftype[com.opensymphony.xwork2.inject.ContainerImpl$10](value[com.opensymphony.xwork2.inject.ContainerImpl$10@5d580c58])andavalueoftype[java.lang.Object[]](value[[Ljava.lang.Object;@3f929548])butfailedtoremoveitwhenthewebapplicationwasstopped.Thisisverylikelytocreateamemoryleak.

org.apache.catalina.loader.WebappClassLoaderclearThreadLocalMap
SEVERE:Thewebapplication[/]createdaThreadLocalwithkeyoftype[com.opensymphony.xwork2.inject.ContainerImpl$10](value[com.opensymphony.xwork2.inject.ContainerImpl$10@5d580c58])andavalueoftype[java.lang.Object[]](value[[Ljava.lang.Object;@3086ca93])butfailedtoremoveitwhenthewebapplicationwasstopped.Thisisverylikelytocreateamemoryleak.

org.apache.catalina.loader.WebappClassLoaderclearThreadLocalMap
SEVERE:Thewebapplication[/]createdaThreadLocalwithkeyoftype[com.opensymphony.xwork2.inject.ContainerImpl$10](value[com.opensymphony.xwork2.inject.ContainerImpl$10@5d580c58])andavalueoftype[java.lang.Object[]](value[[Ljava.lang.Object;@615d91c8])butfailedtoremoveitwhenthewebapplicationwasstopped.Thisisverylikelytocreateamemoryleak.

org.apache.catalina.loader.WebappClassLoaderclearThreadLocalMap
SEVERE:Thewebapplication[/]createdaThreadLocalwithkeyoftype[com.opensymphony.xwork2.inject.ContainerImpl$10](value[com.opensymphony.xwork2.inject.ContainerImpl$10@5d580c58])andavalueoftype[java.lang.Object[]](value[[Ljava.lang.Object;@460e1368])butfailedtoremoveitwhenthewebapplicationwasstopped.Thisisverylikelytocreateamemoryleak.

org.apache.catalina.loader.WebappClassLoaderclearThreadLocalMap
SEVERE:Thewebapplication[/]createdaThreadLocalwithkeyoftype[com.opensymphony.xwork2.inject.ContainerImpl$10](value[com.opensymphony.xwork2.inject.ContainerImpl$10@5d580c58])andavalueoftype[java.lang.Object[]](value[[Ljava.lang.Object;@461c34c6])butfailedtoremoveitwhenthewebapplicationwasstopped.Thisisverylikelytocreateamemoryleak.

org.apache.catalina.loader.WebappClassLoaderclearThreadLocalMap
SEVERE:Thewebapplication[/]createdaThreadLocalwithkeyoftype[com.opensymphony.xwork2.inject.ContainerImpl$10](value[com.opensymphony.xwork2.inject.ContainerImpl$10@5d580c58])andavalueoftype[java.lang.Object[]](value[[Ljava.lang.Object;@65ccd71f])butfailedtoremoveitwhenthewebapplicationwasstopped.Thisisverylikelytocreateamemoryleak.

org.apache.catalina.loader.WebappClassLoaderclearThreadLocalMap
SEVERE:Thewebapplication[/]createdaThreadLocalwithkeyoftype[com.opensymphony.xwork2.inject.ContainerImpl$10](value[com.opensymphony.xwork2.inject.ContainerImpl$10@5d580c58])andavalueoftype[java.lang.Object[]](value[[Ljava.lang.Object;@6b3f686f])butfailedtoremoveitwhenthewebapplicationwasstopped.Thisisverylikelytocreateamemoryleak.

Morg.apache.catalina.loader.WebappClassLoaderclearThreadLocalMap
SEVERE:Thewebapplication[/]createdaThreadLocalwithkeyoftype[com.opensymphony.xwork2.inject.ContainerImpl$10](value[com.opensymphony.xwork2.inject.ContainerImpl$10@5d580c58])andavalueoftype[java.lang.Object[]](value[[Ljava.lang.Object;@fe1866b])butfailedtoremoveitwhenthewebapplicationwasstopped.Thisisverylikelytocreateamemoryleak.

org.apache.catalina.loader.WebappClassLoaderclearThreadLocalMap
SEVERE:Thewebapplication[/]createdaThreadLocalwithkeyoftype[com.opensymphony.xwork2.inject.ContainerImpl$10](value[com.opensymphony.xwork2.inject.ContainerImpl$10@5d580c58])andavalueoftype[java.lang.Object[]](value[[Ljava.lang.Object;@1f3fe2f2])butfailedtoremoveitwhenthewebapplicationwasstopped.Thisisverylikelytocreateamemoryleak.

org.apache.catalina.loader.WebappClassLoaderclearThreadLocalMap
SEVERE:Thewebapplication[/]createdaThreadLocalwithkeyoftype[com.opensymphony.xwork2.inject.ContainerImpl$10](value[com.opensymphony.xwork2.inject.ContainerImpl$10@5d580c58])andavalueoftype[java.lang.Object[]](value[[Ljava.lang.Object;@1b4c8de5])butfailedtoremoveitwhenthewebapplicationwasstopped.Thisisverylikelytocreateamemoryleak.

org.apache.catalina.loader.WebappClassLoaderclearThreadLocalMap
SEVERE:Thewebapplication[/]createdaThreadLocalwithkeyoftype[com.opensymphony.xwork2.inject.ContainerImpl$10](value[com.opensymphony.xwork2.inject.ContainerImpl$10@5d580c58])andavalueoftype[java.lang.Object[]](value[[Ljava.lang.Object;@3ef7c363])butfailedtoremoveitwhenthewebapplicationwasstopped.Thisisverylikelytocreateamemoryleak.

org.apache.catalina.loader.WebappClassLoaderclearThreadLocalMap
SEVERE:Thewebapplication[/]createdaThreadLocalwithkeyoftype[com.opensymphony.xwork2.inject.ContainerImpl$10](value[com.opensymphony.xwork2.inject.ContainerImpl$10@5d580c58])andavalueoftype[java.lang.Object[]](value[[Ljava.lang.Object;@7c3cb8e0])butfailedtoremoveitwhenthewebapplicationwasstopped.Thisisverylikelytocreateamemoryleak.

org.apache.catalina.loader.WebappClassLoaderclearThreadLocalMap
SEVERE:Thewebapplication[/]createdaThreadLocalwithkeyoftype[com.opensymphony.xwork2.inject.ContainerImpl$10](value[com.opensymphony.xwork2.inject.ContainerImpl$10@5d580c58])andavalueoftype[java.lang.Object[]](value[[Ljava.lang.Object;@768db9d8])butfailedtoremoveitwhenthewebapplicationwasstopped.Thisisverylikelytocreateamemoryleak.

org.apache.catalina.startup.HostConfigcheckResources
INFO:Undeployingcontext[/]

我不明白这个问题。任何人都可以解决这个问题吗?

我每次都通过杀死Java进程来重启tomcat。

它工作正常10至15分钟,然后每次都挂起。

1 个答案:

答案 0 :(得分:0)

您的网络应用程序存在多个问题。

  1. 不要将任何版本的servlet-api.jar打包到您的应用程序中 - 容器将提供它。
  2. 您需要在Web应用程序停止时取消注册您的驱动程序。
  3. 使用ThreadLocals时需要更加小心。 ThreadLocal永远不应该存在于单个请求的范围之外。
  4. 有关内存泄漏源以及如何修复它们的更多信息,请阅读: http://people.apache.org/~markt/presentations/2010-11-04-Memory-Leaks-60mins.pdf