在 Ubuntu 中安装的 Tomcat6 会定期崩溃

在 Ubuntu 中安装的 Tomcat6 会定期崩溃

我在 Ubuntu 操作系统中安装了 Tomcat6,当我运行 Web 应用程序时,服务器会定期崩溃。我尝试了很多方法,但没有找到解决方案。我已将内存增加到 2048mb,但仍然出现此类错误。以下是我收到的错误。任何帮助都将不胜感激。

org.apache.tomcat.util.http.Parameters processParametersINFO: 
Invalid chunk starting at byte [312] and ending at byte [312] with a value of    [null] 
ignoredException in thread "Timer-1" Exception in thread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0" Exception in thread
"com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2" Exception in thread    
"com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1" Exception in thread 
"Timer-2" Exception in thread "http-8080-4" Exception in thread "http-8080-8" Exception in    thread 
"http-8080-17" Exception in thread "org.hibernate.cache.StandardQueryCache.data"   Exception in thread 
"org.hibernate.cache.UpdateTimestampsCache.data" Exception in thread 
"org.hibernate.cache.StandardQueryCache.data" Exception in thread   
"org.hibernate.cache.StandardQueryCache.data" Exception in thread 
"org.hibernate.cache.UpdateTimestampsCache.data" Exception in thread 
"org.hibernate.cache.StandardQueryCache.data" Exception in thread 
"org.hibernate.cache.StandardQueryCache.data" Exception in thread 
"org.hibernate.cache.UpdateTimestampsCache.data" Exception in thread "com.safenet.usermgmt.User.data" 
Exception in thread "http-8080-7" Exception in thread  "http-8080-12" Exception in thread "http-8080-16" 
Exception in thread "http-8080-14"   Exception in thread "http-8080-13" Exception in thread "http-8080-15" 
Exception in thread   "http-8080-6" 
OpenJDK Client VM warning: Exception java.lang.OutOfMemoryError occurred   dispatching signal SIGTERM to handler- the VM may need to be forcibly terminated

答案1

停止服务器,存档日志文件。重新启动服务器。发生异常时,发布完整的堆栈跟踪。如果错误长时间没有发生,您可能需要添加:

-XX:-OmitStackTraceInFastThrow

到您的 CATALINA_OPTS。

检查您的应用程序是否正确关闭了它在 try/catch 的 finally 块中使用的所有 DB 连接。

答案2

如果您在启用 jmxremote 的情况下启动 Tomcat 实例,那么您将更容易确定任何问题。

将以下内容添加到CATALINA_OPTSTomcat 的环境变量并重新启动 JVM。

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9010
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false

完成此操作后,您可以使用它jconsole来监视内存使用情况并查找异常趋势。您的应用程序中可能存在严重的内存泄漏,从而导致这种情况。

相关内容