Tomcat在Eclipse中没有关闭

Tomcat在Eclipse中没有关闭

本文介绍了Tomcat在Eclipse中没有关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个相对简单的网络应用程序,其中主servlet实现了 ServletContextListener 接口,以确定上下文是启动还是停止。我实现了我的 contextInitialized contextDestroyed init destroy 方法( init destroy call super 在基类上)。我目前没有实现真正的功能,除了我在 contextInitialized 方法中初始化了log4j之前,我加载了 log4j.properties 文件。

I'm building a relatively simple web-app where the main servlet implements the ServletContextListener interface to determine whether the context has been started or stopped. I've implemented my contextInitialized, contextDestroyed, init and destroy methods (both init and destroy call super on the base class). I've currently implemented no real functionality other than that I've initialized log4j in the contextInitialized method where I load the log4j.properties file.

当我从Eclipse中启动和停止Tomcat服务器时,所有内容都以正确的顺序调用(我正在使用一些 System.out.println 来测试这个),但在停止服务器大约10秒后,我会看到一个Eclipse弹出窗口,说明如下:

When I start and stop the Tomcat server from within Eclipse however, everything is called in the correct order (I'm using some System.out.println's to test this) but after about 10 seconds of stopping the server I'm presented with an Eclipse popup stating the following:

这是我打印的内容当我停止服务器时,Eclipse控制台:

This is what's printed in my Eclipse console when I stop the server:

之后最后一个 INFO 消息,它只是挂在那里,直到弹出窗口出现。如果我选择等待,按取消,Eclipse变得不可用,我必须从终端中杀死Eclipse进程。

And after the last INFO message it just hangs there until the popup appears. If I choose to wait, press Cancel, Eclipse becomes unusable and I have to kill the Eclipse process from a terminal.

任何关于如何解决这个问题的输入将会很大赞赏。

Any input on how to solve this issue would be greatly appreciated.

更新:

问题是由非守护进程线程,我开始在我的 init 方法(忘了提到:)。即使该方法似乎已被弃用,即使使用 stop 方法显式停止线程也解决了此问题。

The problem was caused by a non-daemon thread that I'm starting within my init method (forgot to mention that :). The problem was solved by explicitly stopping the thread with the stop method, even though that method seems to be deprecated.

推荐答案

如,这应该与清理问题有关。

As mentioned in this thread, this should be related to a cleanup issue.

这篇关于Tomcat在Eclipse中没有关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 17:58