33

I tried stopping tomcat. It failed with this message:

  • Tomcat did not stop in time. PID file was not removed.

I then tried again and got this:

  • PID file (/opt/tomcat/work/catalina.pid) found but no matching process was found. Stop aborted.

I then tried starting tomcat in debug mode and got this:

  • PID file (/opt/tomcat/work/catalina.pid) found. Is Tomcat still running? Start aborted.

I them deleted /opt/tomcat/work/catalina.pid and tried restarting and got this:

  • $CATALINA_PID was set (/opt/tomcat/work/catalina.pid) but the specified file does not exist. Is Tomcat running? Stop aborted.

Anyone know how to get tomcat restarted?

3
  • What does ps say (assuming you run Tomcat on some *nix)? Commented Sep 11, 2012 at 12:28
  • Windows by using a Linux emulator. ps returns "webadmin 24735 23900 0 13:28 pts/0 00:00:00 grep tomcat" Commented Sep 11, 2012 at 12:31
  • In the environments I know, ps -ef | grep java will give you the Tomcat instance's process ID (maybe among other Java processes). What do you see? Commented Sep 11, 2012 at 12:39

16 Answers 16

10

Make sure Tomcat is not currently running and the PID file is removed. Them you should start Tomcat successfully.

If you start fresh then:

  1. Create setenv.sh file in <CATALINA_HOME>/bin.
  2. In it I set CATALINA_PID=/tmp/tomcat.pid (or other directory of your choice) so you have more control over the Tomcat process.

Then to start Tomcat find catalina.sh in <CATALINA_HOME>/bin and execute:

./catalina.sh start 

and to stop it run:

./catalina.sh stop 10 -force 

From catalina.sh script's doc:

./catalina.sh Usage: catalina.sh ( commands ... ) commands: start Start Catalina in a separate window stop Stop Catalina, waiting up to 5 seconds for the process to end stop n Stop Catalina, waiting up to n seconds for the process to end stop -force Stop Catalina, wait up to 5 seconds and then use kill -KILL if still running stop n -force Stop Catalina, wait up to n seconds and then use kill -KILL if still running 

Note: If you want to use -force flag then setting CATALINA_PID is mandatory.

Sign up to request clarification or add additional context in comments.

1 Comment

Had the same problem: "Tomcat did not stop in time". Your solution works perfectly. Some apps need a "long" time to stop. So "stop 20" was my soltion.
9

I had this error message having started up a second Tomcat server on a Linux server.

$CATALINA_PID was set but the specified file does not exist. Is Tomcat running? Stop aborted. 

When starting up the 2nd Tomcat I had set CATALINA_PID as asked but my mistake was to set it to a directory (I assumed Tomcat would write a default file name in there with the pid).

The fix was simply to change my CATALINA_PID to add a file name to the end of it (I chose catalina.pid from the above examples). Next I went to the directory and did a simple:

touch catalina.pid 

creating an empty file of the correct name. Then when I did my shutdown.sh I got the message back saying:

PID file is empty and has been ignored. Tomcat stopped. 

I didn't have the option to kill Tomcat as the JVM was in use so I was glad I found this.

3 Comments

What are you talking about tomcat never asks to set CATALINA_PID
Not sure I understand you @PhilipRego. Are you replying to me or to #SmallChess. Sorry. Pleased elaborate.
"I had set CATALINA_PID as asked" Tomcat doesn't ask you to set this.
4

It seems Tomcat was actually stopped. I started it and it started fine. Thanks all.

Comments

3

Recent I have met several times of stop abnormal. Although shutdown.sh provides some information, The situations are:

  • result of the command ps -ef| grep java is Null.
  • result of the command ps -ef| grep java is not null.

My opinion is just kill the process of Catalina and remove the pid file (In your situation is /opt/tomcat/work/catalina.pid.)

The result seems not so seriously to influence others.

Comments

3

sometimes if the same pid is running after reboot tomcat will not start

my pid file was at apache-tomcat/temp/tomcat.pid

as a solution, I just check if the PID is of Catalina

change file apache-tomcat/bin/catalina.sh about line 386

from ps -p $PID >/dev/null 2>&1

to ps -fp $PID |grep catalina >/dev/null 2>&1

excerpt from catalina.sh file

 if [ ! -z "$CATALINA_PID" ]; then if [ -f "$CATALINA_PID" ]; then if [ -s "$CATALINA_PID" ]; then echo "Existing PID file found during start." if [ -r "$CATALINA_PID" ]; then PID=`cat "$CATALINA_PID"` ps -fp $PID |grep catalina >/dev/null 2>&1 #this line if [ $? -eq 0 ] ; then echo "Tomcat appears to still be running with PID $PID. Start aborted." echo "If the following process is not a Tomcat process, remove the PID file and try again:" ps -f -p $PID exit 1 else echo "Removing/clearing stale PID file." rm -f "$CATALINA_PID" >/dev/null 2>&1 if [ $? != 0 ]; then if [ -w "$CATALINA_PID" ]; then cat /dev/null > "$CATALINA_PID" else echo "Unable to remove or clear stale PID file. Start aborted." exit 1 fi fi fi else echo "Unable to read PID file. Start aborted." 

Comments

1

You can go to the location ${CATALINA_HOME}/logs/ open catalina.pid. Here we will get the pid. then terminate the process. kill -9 pid

Comments

1

Have you try $ sudo ./catalina.sh stop? It worked in my case.

Comments

1

FIRST --> rm catalina.engine

THEN -->./startup.sh

NEXT TIME you restart --> ./shutdown.sh -force

Comments

1

The catalina.pid is missing in your case.

This file is located under {your_jira_dir}/work/catalina.pid and it contains the pid of the current instance of jira.

so

ps aux | grep jira 
  • find the correct entry
  • Copy the PID of the output and create a file that only contains this PID. - Make sure it can be read and written by the user which runs jira.
  • Try to shutdown jira again.

Comments

1

sudo systemctl stop tomcat

did it for me

Comments

1

Follow this :)

  1. Open : /etc/systemd/system/tomcat.service

Can you see JAVA_HOME ? : modify it like below

Environment="JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64" 

At 1.11.0 - insert your own Jdk version

  1. systemctl daemon-reload

  2. sudo systemctl start tomcat


Now, in eclipse -> Add Server -> .....

Got struck at tomcat installation directory ??

  1. Extract the tomcat tar file you already downloaded.
  2. Now go back to eclipse -> add server -> Browse -> Point to extracted file (done in step 1 above :)

Comment if you get struck in somewhere else too )

Comments

0

You can always try to kill the process in case you see this kind of issues. You can get the process ID either from PS or from pid file and kill the process.

Comments

0

In my case, the tomcat.pid is under /opt/tomcat/temp/. Tried to delete it manually. Still didn't work. After check setnev.sh in /opt/tomcat/bin/, notice there is a line of code to define JAVA_HOME:

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre 

Commented out this line, restart Tomcat. It works! Since I did a yum update and a new minor version of Java update coming from 1.8.0.212 to 1.8.0.222. Lessons learned: Hard-code should be avoided.

Comments

0

I faced the same problem as mentioned below.

PID file found but no matching process was found. Stop aborted.

Solution is to find the free space of the linux machine by using the following command

df -h

The above command shows my home directory was 100% used. Then identified which files to be removed by using the following command

du -h .

After removing, it was able to perform IO operation on the linux machine and the tomcat was able to start.

Comments

0

To make sure apache tomcat is not running, you could use following in Linux.

ps -ef | grep tomcat // it will return output if tomcat is up and running 

If it is running, use either one of the options to stop tomcat:

./catalina.sh stop 

Passing "stop" argument for catalina.sh --> stops the Tomcat in the foreground and displays the running logs in the same console. when the console terminal is closed it will terminate the tomcat.

./shutdown.sh 

This way is firing the shutdown.sh to stop your Tomcat server and finally the last way is using service tomcat stop as below.

sudo service tomcat stop 

Comments

0

Most probably this would be helpful

  • Tomcat listens to Shutdown signals on 8005 port
  • You probably have INPUT drop policy if you have stop timeout
  • ADD iptables rule:
    iptables -A INPUT -s 127.0.0.1/32 \ -p tcp -m tcp \ --dport 8005 \ -m comment --comment "Tomcat Shutdown port" -j ACCEPT 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.