Failed to stop Tomcat

I am very new to Tomcat and just set up my tomcat using jprofiler. But now it is not possible to stop the tomcat server by receiving 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 the firewall is disabled in the field.

 [ root@localhost bin]# service iptables status Firewall is stopped. 
+4
source share
3 answers

To find the tomcat PID, run:

 ps -ef | grep tomcat 

what to use:

 kill -9 PID 

Or in one command:

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

Another thing is that you can have a watchdog timer running, which continues to operate tomcat - in this case, you also want to disable (or kill) the watchdog timer.

+7
source

You have inserted the VM parameters to load the JProfiler agent in your tomcat script. JProfiler Agent expects to be able to listen for incoming connections on a specific port (8849 by default). The port is already in use by a running Tomcat. When you run the tomcat script again, the JVM initialization will fail because the profiling agent cannot be initialized.

You will need to remove the JVM -agentlib:[path to jprofilerti.dll] parameter -agentlib:[path to jprofilerti.dll] from your tomcat script run or make it conditional so that it does not apply to the stop command.

0
source

According to the Tomcat documentation, you can define the PID file that the Tomcat process identifier should store.

  • Create a shell script "setenv.sh" in the Tomcat bin directory.
  • This file refers to catalina.sh, so it should have exactly the same name.
  • You can simply specify the tomcat user information in "setenv.sh". Something like below ..

    #!/bin/bash CATALINA_PID="$CATALINA_BASE/bin/catalina.pid"

  • Using the above step, tomcat will search for a file named "catalina.pid" in the bin directory. So just create it.

You are done. Just remember to stop tomcat with the -force option.

 ./shutdown.sh -force 

The force option tells tomcat to kill tomcat using the PID if it cannot stop for a given time.

0
source

All Articles