击中某些时间后,Servlet停止在Tomcat服务器上工作 [英] Servlet stops working on Tomcat server after some hits or time

查看:92
本文介绍了击中某些时间后,Servlet停止在Tomcat服务器上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一些servlet有一个非常奇怪的问题.下面是我的配置:

I have a very strange issue with some of my servlets. Below is my configuration:

  • 文件夹A在Tomcat目录中部署了X个servlet
  • 文件夹B在Tomcat目录中部署了Y个servlets

经过一定时间或访问文件夹B中的任何servlet后,它会停止正常工作,而与此同时,文件夹A中的所有servlet都可以正常工作.

After certain amount of time or hits to any of the servlets in Folder B, it stops working properly, whereas at same time all servlets of Folder A works fine.

我无法追踪我在哪里做错了.

I am not able to trace where I am doing mistake.

两个文件夹的servlet的所有编码都是相同的,唯一的区别是它们正在与不同的DB交互,但这是对DB的非常简单的只读操作.

All coding for both folder's servlets is the same, the only difference is they are interacting with different DB's, but it is very simple read only operation with DB though.

有什么想法吗?

推荐答案

问题出在Logger上.当线程完成执行并且没有明显的方法(例如close())关闭Logger实例时,不会隐式释放Logger实例,因此doGet/doPost线程不会正确退出.

The issue lies with the Logger. The Logger instance is not implicitly released when the thread finishes execution and since there is no obvious method such as close() to close the Logger instance, the doGet / doPost thread does not exit properly.

摆脱Logger,或者显式销毁实例/将其分配为null即可解决问题.

Getting rid of the Logger, or alternatively, explicitly destroying the instance / assigning it to null will solve the problem.

这篇关于击中某些时间后,Servlet停止在Tomcat服务器上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆