开发者社区> 问答> 正文

关于 web项目运行过程中的疑惑,服务器运行时间长就会现保存数据出现奇怪的异常 问题

这问题困扰很久了,以前只是一两月发生一次就没在意,每次重启tomcat就很正常了。但是现在是基本上坚持不了一天就需要重启tomcat就要重启,否则出现的问题简直不可理喻,比如提交表单数据到action,比如hibernate级联取值,这些都会报空指针异常,而这些都实实在在的有数据提交啊,同样的代码,只是时间不同就出现不一样的结果。自己也分析了很久,从开始分析代码本身,并没有发现什么不对,再分析配置,配置还是以前那个配置,没任何变化,后来分析tomcat,因为jvm之前报了好几次内存溢出的异常,我就优化jvm,现在没报内存溢出了,但是确出现功能性异常,这些功能在我本地没有任何问题,在服务上启动tomcat之初也没问题,只是用久了会出问题,比如现在是一天不到就算久了。。。以前是一个月半个月不用理睬就没事

每次重启tomcat都会有很多“严重”的提示信息,都提示说可能导致内存溢出。以前没有过,所以每次shutdown的时候都要很长时间才能关掉,唉现在搞得想无头苍蝇似的,有经历的朋友希望给个思路把,比死都难受额

关闭tomcat的时候出现了下面这些严重提示,只截取了部分,其他都一样了

信息: Pausing ProtocolHandler ["http-nio-8080"]
2013-6-3 0:31:04 org.apache.coyote.AbstractProtocol pause
信息: Pausing ProtocolHandler ["ajp-apr-8050"]
2013-6-3 0:31:05 org.apache.catalina.core.StandardService stopInternal
信息: Stopping service Catalina
2013-6-3 0:31:05 de.javakaffee.web.msm.MemcachedSessionService shutdown
信息: Stopping services.
2013-6-3 0:31:05 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [] 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.
2013-6-3 0:31:05 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [] appears to have started a thread named [AWT-Windows] but has failed to stop it. This is very likely to create a memory leak.
2013-6-3 0:31:05 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [] appears to have started a thread named [Resource Destroyer in BasicResourcePool.close()] but has failed to stop it. This is very likely to create a memory leak.
2013-6-3 0:31:05 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
严重: The web application [] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10](value [com.opensymphony.xwork2.inject.ContainerImpl$10@10d0bdc]) and a value of type [java.lang.Object[]](value [[Ljava.lang.Object;@185a977]) 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. 
2013-6-3 0:31:10 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
严重: The web application [] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal](value [Transactional resources]) and a value of type [java.util.HashMap](value [{org.hibernate.impl.SessionFactoryImpl@15ebb08=org.springframework.orm.hibernate3.SessionHolder@38f49f, com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [numThreadsAwaitingCheckoutDefaultUser] ]=org.springframework.jdbc.datasource.ConnectionHolder@1dc8b67}]) 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. 
2013-6-3 0:31:10 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
严重: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal](value [java.lang.ThreadLocal@c92222]) and a value of type [org.compass.core.impl.DefaultCompassSession](value [org.compass.core.impl.DefaultCompassSession@e00662]) 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. 
2013-6-3 0:31:10 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
严重: The web application [] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10](value [com.opensymphony.xwork2.inject.ContainerImpl$10@10d0bdc]) and a value of type [java.lang.Object[]](value [[Ljava.lang.Object;@1c30f74]) 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. 
2013-6-3 0:31:10 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks

展开
收起
爵霸 2016-03-04 15:16:39 5874 0
1 条回答
写回答
取消 提交回答
  • 会不会是一些代码中的隐性错误,如在一些判断处理的地方按正常情况来的值都是对的,但某些情况得到的值超出了特定的范围,造成迭代错误。

    2019-07-17 18:52:21
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Web应用系统性能优化 立即下载
高性能Web架构之缓存体系 立即下载
PWA:移动Web的现在与未来 立即下载