java - 运行 Servlet 时出现 RuntimeException : Tomcat restarting on its own

标签 java eclipse apache tomcat servlets

我是 servlet 的新手,使用的是 Tomcat 版本 7.0.34(我们被指示只能使用这个版本)。我的问题是 Tomcat 似乎在某个时间点重新启动,当我一段时间不与 servlet 交互时会发生这种情况。我看到以下内容:

enter image description here .

此外,当我尝试通过 eclipse 进行调试时,我在调试窗口中看到以下条目:

Daemon Thread [http-bio-80-exec-1] (Suspended (exception RuntimeException)) 
ThreadPoolExecutor(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker) line: not available 
ThreadPoolExecutor$Worker.run() line: not available 
TaskThread(Thread).run() line: not available    

这是在控制台中:

SEVERE: The web application [/csj] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation.
Okt 03, 2016 1:39:39 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/csj] is completed

我想知道Tomcat重启的原因。如果我一直点击按钮没有延迟,那么这个问题就不会出现。

我试着看这里:Tomcat showing this error "This is very likely to create a memory leak". How to resolve this issue?在这里:The web application [ROOT] is still processing a request that has yet to finish. [Tomcat]但我不知所措。

这个问题似乎在较新版本的 Tomcat 中解决了:http://wiki.apache.org/tomcat/MemoryLeakProtection .不过我想了解这个问题是什么。

编辑:使用eclipse-mars

最佳答案

您的 tomcat 配置为“热部署”,即如果您更改代码,tomcat 将合并新代码而无需重新启动服务器。这个可以在tomcat上配置,也可以在eclipse中配置。你可以去那里禁用它,因为它实际上是一个令人头疼的问题并且会消耗更多时间,并且有时无法正常工作。
Tomcat 使用单独的类加载器加载每个 Web 应用程序。它监视您的文件是否发生更改,如果发生更改,它会通过销毁类加载器卸载您的 webapp,并使用新的类加载器再次加载。发生这种情况时,您将看到您提到的各种日志。
有关 eclipse 配置,请参阅 here
有关 tomcat 配置,请参阅 here 此外,从 Tomcat 文档中,阅读 this

关于java - 运行 Servlet 时出现 RuntimeException : Tomcat restarting on its own,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39836548/

相关文章:

java - JTextArea 不会在 MigLayout 中垂直更改大小

java - 在数组的另一个类中调用 getAverage 方法

java - android studio 无法解析import com.google.android.gms.location.places.Place;

java - 在带有 Netbeans 7.3 的诺基亚 SDK 2.0 中找不到 JRE

android - 无法在没有错误的情况下在android资源文件中插入字符串

apache - 烦人的 Silex 子目录 .htaccess 问题

java - 为什么核心 Java 库不使用枚举来实现单例模式?

java - 其他上下文请求的 Tomcat 404 页面

php - Apache 服务器压缩和利用浏览缓存问题

apache - Hadoop hive 加载错误