Unable to stop Tomcat
Asked Answered
C

3

6

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.
Cartilaginous answered 8/8, 2012 at 19:1 Comment(4)
But it says that Tomcat has stoppedDeipnosophist
It also prompts an error JProfiler> Waiting for a connection from the JProfiler GUI ... JProfiler> ERROR: Could not bind socket. and yes Tomcat is still running after stopping it multiple times using the service or init.d scriptCartilaginous
Have a look in the script that is called by the service command. Perhaps some unwanted configuration has been entered. You'd most likely find the script somewhere close to /etc/init.d.Hawser
I voted to close this question because it is not a programming question and it is off-topic on Stack Overflow. Non-programming questions about managing your servers should be asked on Server Fault. In the future please ask questions like this there.Wolffish
M
9

In order to find tomcat PID run:

ps -ef | grep tomcat

then use this command:

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

Mcwhorter answered 8/8, 2012 at 19:11 Comment(1)
I have checked it and its running, And watch dog is not enabled on the server.Cartilaginous
I
0

You have inserted VM parameters for loading the JProfiler agent in your tomcat script. The JProfiler agent expects to be able to listen for incoming connections on a specific port (by default 8849). The port is already in use by the running Tomcat. When you start the tomcat script again, the initialization of the JVM fails because the profiling agent could not be initialized.

You would have to remove the JVM parameter -agentlib:[path to jprofilerti.dll] from your tomcat start script or make it conditional so that it is not applied for the "stop" command.

Initiative answered 9/8, 2012 at 13:26 Comment(0)
S
0

As per the Tomcat documentation, you can defined a PID file which is supposed to store the Process ID of Tomcat.

  1. Create a shell script "setenv.sh" in Tomcat bin directory.
  2. This file is referenced in catalina.sh, so it should have exactly the same name.
  3. You can just have the tomcat pid information in "setenv.sh". Something like below..

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

  4. With the above step, tomcat will look for a file named as "catalina.pid" in its bin directory. So just create it.

You're done. Just don't forget to stop tomcat with -force option.

./shutdown.sh -force

The force option tells tomcat to kill tomcat by PID, if it's not able to stop within given time.

Ster answered 8/9, 2016 at 18:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.