Richi
Richi

Reputation: 1

Missing pid file running Tomcat 9.0.21

Is there no longer any pid file in this newer Tomcat version ? Or is there propably any configuration option to activate it ? Platform OS is OpenSuse Leap 15.1

Upvotes: 0

Views: 3826

Answers (2)

Enigo
Enigo

Reputation: 3885

Since I've recently faced exactly the same issue let me share my findings here.

First of all, take a look at those two issues:

In Tomcat 9.0.14 there were two changes - 1 and 2 - introduced that basically broke pid creation. That also prevents Tomcat from running as systemd service. Later it was fixed, but I wasn't able to find the exact version unfortunately. As per the changelog it should be the version 9.0.17 but as we are running Ubuntu 18 where the latest available Tomcat 9 package version is 9.0.16 I cannot check it.

There is also a way to fix it yourself if you want\can change catalina.sh script. Search for the following line (there are two of them):

2\>\&1 \&\& echo \$! \>\"$catalina_pid_file\" \; \} $catalina_out_command "&"

and change it to:

2\>\&1 \& echo \$! \>\"$catalina_pid_file\" \; \} $catalina_out_command "&"

Note the single ampersand symbol.

Upvotes: 2

Christopher Schultz
Christopher Schultz

Reputation: 20862

If you want Tomcat to create a pid-file, then you need to make sure that the CATALINA_PID environment variable is set when calling bin/catalina.sh (or bin/startup.sh).

If you are using systemd with a config file, you may have to configure things differently because I think bin/catalina.sh is not used. Also, I'm pretty sure that using systemd obviates the need for ever using a pid-file. It's one of the things the systemd folks find abhorrent about traditional startup scripts IIRC.

Upvotes: 1

Related Questions