Tomcat在Eclipse中没有关闭 [英] Tomcat not shutting down within Eclipse

查看:516
本文介绍了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:


服务器Tomcat v6.0服务器在本地主机
没有响应。你想要
终止这个服务器吗?单击确定
终止服务器或单击取消
继续等待。

Server Tomcat v6.0 Server at localhost is not responding. Do you want to terminate this server? Click OK to terminate the server or click Cancel to continue waiting.

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

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


04/01/2010 7:39:13 PM org.apache.catalina.core.StandardService停止

信息:停止服务Catalina

contextDestroyed

04/01/2010 7:39:13 PM org.apache.coyote.http11。 Http11Protocol destroy

信息:在http-8080上停止Coyote HTTP / 1.1

04/01/2010 7:39:13 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
contextDestroyed
04/01/2010 7:39:13 PM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080

之后最后一个 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.


如果一个webapp没有完全清理,特别是在停止非守护线程启动,Tomcat将无法关闭。

单击停止具有提供超时的优势。

如果Tomcat在超时期间无法停止,则会显示一个对话框将出现让您选择终止服务器或继续等待。

If a webapp doesn't cleanup completely, especially with respect to stopping non-daemon threads it starts, Tomcat will fail to shutdown.
Clicking "Stop" has the advantage of providing a timeout.
If Tomcat fails to stop within the timeout, a dialog will appear giving you the option to terminate the server or continue waiting.

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

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