从 Eclipse 运行 Tomcat 时如何杀死 Tomcat?
我正在运行随 Eclipse 下载一起提供的 Tomcat(不,我不想下载并安装整个 Tomcat),有时它会在停止或重新启动时挂起,我能找到让它工作的唯一方法是重新启动我的所有 Eclipse。我在Windows下使用它。
有什么方法可以终止 Tomcat 进程(它不会出现在任务管理器中)?
I am running the Tomcat that gets delivered with your Eclipse download (no, I don't want to download and install the entire Tomcat), and sometimes it hangs when stopping or restarting, and the only way I can find to make it work is restarting all my Eclipse. I am using it under Windows.
Is there any way to kill the Tomcat process (which doesn't appear in the Task Manager)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
它在任务管理器中显示为
javaw.exe
。另一种方法是执行Tomcat/bin/shutdown.bat
。至于挂起问题,您确定您的 Web 应用程序不会生成可能阻止 Tomcat 关闭的非托管线程吗?
It appears as
javaw.exe
in task manager. An alternative is to executeTomcat/bin/shutdown.bat
.As to the hang problem, are you sure that your webapp isn't spawning unmanaged threads which might be blocking Tomcat's shutdown?
在Windows上,如果你知道Tomcat监听的端口(下面是8080),你可以找到Tomcat进程的PID,然后从cmd中杀死它:
On Windows, if you know the port Tomcat listens to (below, it is 8080), you can find the PID of the Tomcat process and then kill it from cmd:
当任务管理器中找不到tomcat时,我使用更好的方法来关闭tomcat。
1) 从以下链接下载TCPView(仅285kb)。
http://technet.microsoft.com/en-in/sysinternals/bb897437。 aspx
2) 提取文件夹并启动TCPView应用程序。
3) 右键单击java.exe并选择结束进程选项。
这会很容易地停止你的tomcat。这个工具在监控端口使用情况方面非常有用。
注意:当 Tomcat 包含某些恶魔或非托管时,运行 TOMCATPATH/bin/shutdown.bat 可能不会关闭 Tomcat
线程。在这种情况下,TCPView 工作正常,没有任何问题。
I use better way to shutdown tomcat when it is not found in task manager.
1) Download TCPView(only 285kb) from following link.
http://technet.microsoft.com/en-in/sysinternals/bb897437.aspx
2) Extract folder and start TCPView application.
3) Right click on java.exe and select End Process option.
this would stop your tomcat easily.. This tool is very useful in monitoring port usage.
NOTE: Running TOMCATPATH/bin/shutdown.bat may not shutdown Tomcat when it contains some demon or unmanaged
threads. In such cases TCPView works fine without any issues.
您可以在 Eclipse 中为 Tomcat 服务器设置启动和关闭超时。如果超过这些超时,Eclipse 将弹出一条消息,询问您是否要终止它,还是继续等待。
要设置这些,请双击“服务器”选项卡中的服务器名称。它将打开一个如下窗口:
右侧有一个超时部分。我将启动时间设置为一天(这样我就可以在不超时的情况下调试启动),并将关闭时间设置为 30 秒(通常这可能非常短,因为大多数应用程序都可以在强制关闭时正常运行)。
You can set a timeout on startup and shutdown for your Tomcat server in Eclipse. If these timeouts are exceeded, Eclipse will pop up a message asking you if you want to kill it, or keep waiting.
To set these, double-click the name of the server in your Servers tab. It'll open a window like this:
There's a Timeouts section on the right hand side. I set startup to a day (so I can debug startup without it timing out), and shutdown to 30 seconds to be generous (usually this can be very short, since most apps can survive a forced shutdown with no issues).
如果您使用 Linux,请尝试以下步骤。
ps aux | grep catalina
)myname 2244 5.5 0.3 57020937 2110741 ? Sl Oct03 5160:01 /usr/lib/jvm/java-1.8.0-<...>/bin/java <...> org.apache.catalina.startup.Bootstrap start
/usr/lib/jvm/<...>
和<...> 之间的所有内容;.Bootstrap
stop
并运行它本质上,您将采用 Eclipse 用来启动 Tomcat 的相同命令并修改最后一个参数来停止 Tomcat 。
If you use Linux, try the following steps.
ps aux | grep catalina
)myname 2244 5.5 0.3 57020937 2110741 ? Sl Oct03 5160:01 /usr/lib/jvm/java-1.8.0-<...>/bin/java <...> org.apache.catalina.startup.Bootstrap start
/usr/lib/jvm/<...>
and<...>.Bootstrap
stop
at the end of your command and run itEssentially, you would take the very same command that was used by Eclipse to start Tomcat and modify the last argument to stop Tomcat.