Unable to stop Tomcat

PratapSingh picture PratapSingh · Aug 8, 2012 · Viewed 12.8k times · Source

I am very new to Tomcat and just configured my tomcat with jprofiler. But now unable to stop tomcat server, getting the following error message.

[root@localhost bin]# service tomcat stop 
Stopping .
Using CATALINA_BASE:   /data/applications/apache-tomcat-6.0.26
Using CATALINA_HOME:   /data/applications/apache-tomcat-6.0.26
Using CATALINA_TMPDIR: /data/applications/apache-tomcat-6.0.26/temp
Using JRE_HOME:        /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0
Using CLASSPATH:       /data/applications/apache-tomcat-6.0.26/bin/bootstrap.jar
JProfiler> Protocol version 35
JProfiler> Using JVMTI
JProfiler> JVMTI version 1.1 detected.
JProfiler> 32-bit library
JProfiler> Listening on port: 8849.
JProfiler> Instrumenting native methods.
JProfiler> Can retransform classes.
JProfiler> Can retransform any class.
JProfiler> Native library initialized
JProfiler> VM initialized
JProfiler> Waiting for a connection from the JProfiler GUI ...
JProfiler> ERROR: Could not bind socket.
\n\nTomcat has shutdown

I am not sure what is wrong in my configuration and yes firewall is disabled on the box.

[root@localhost bin]# service iptables status
Firewall is stopped.

Answer

Nir Alfasi picture Nir Alfasi · Aug 8, 2012

In order to find tomcat PID run:

ps -ef | grep tomcat

than use:

kill -9 PID

Or in one command:

kill -9 $(ps -ef | grep tomcat | grep -v "grep" | awk '{print $2}')

Another thing, you might have a watchdog running that keeps bringing tomcat back up - in such case you'll want to turn off (or kill) the watchdog as well