Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to kill Tomcat when running it from Eclipse?

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)?

like image 638
Carlos Sanchez Avatar asked Dec 02 '10 23:12

Carlos Sanchez


People also ask

How do I know if Tomcat is running in Eclipse?

More specifically, looking at the Eclipse plugin code at https://github.com/eclipse/webtools.servertools/blob/master/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java around line 540 (look for the comment "//ping server for startup") I see that ...


2 Answers

It appears as javaw.exe in task manager. An alternative is to execute Tomcat/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?

like image 70
BalusC Avatar answered Sep 25 '22 21:09

BalusC


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:

> netstat -aon | find "8080"   TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       2196   TCP    [::]:8080              [::]:0                 LISTENING       2196 > taskkill /pid 2196 /f   SUCCESS: The process with PID 2196 has been terminated. 
like image 42
Andrei Epure is hiring Avatar answered Sep 26 '22 21:09

Andrei Epure is hiring