admin管理员组文章数量:1403084
After a reboot Tomcat didn't start due to a existing PID file:
/opt/tomcat/bin # ./version.sh
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr/lib/jvm/temurin-17-jre-amd64
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS: -Xmx6000M -Xms6000M -XX:InitialCodeCacheSize=128M -XX:ReservedCodeCacheSize=128M ...
Using CATALINA_PID: /opt/tomcat/work/catalina.pid
Server version: Apache Tomcat/10.1.28
Server built: Aug 2 2024 15:14:43 UTC
Server number: 10.1.28.0
OS Name: Linux
OS Version: 5.15.0-134-generic
Architecture: amd64
JVM Version: 17.0.14+7
JVM Vendor: Eclipse Adoptium
Why doesn't the CATALINA_PID point to sst like "/run/..." (which is a tmpfs and empty after reboot)?
The systemctl servicefile runs the commands as user "tomcat" so it can't create "/run/tomcat/".
As far as I can see, there are two bad options (with a common core) and a third really ugly one:
Let CATALINA_PID point to "/run/tomcat/catalina.pid" and create the dir in advance writable for tomcat.tomcat
Delete the /opt/tomcat/work/catalina.pid after reboot deterministic before Tomcat starts.
Rewrite the startingprocess according to FSH and systemd "standard"
(uaf): Check after reboot, if (Tomcat is enabled and Tomcat not running and pid is older than uptime), removing pid and starting Tomcat.
Any other suggestions or ideas for a general solution?
After a reboot Tomcat didn't start due to a existing PID file:
/opt/tomcat/bin # ./version.sh
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr/lib/jvm/temurin-17-jre-amd64
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS: -Xmx6000M -Xms6000M -XX:InitialCodeCacheSize=128M -XX:ReservedCodeCacheSize=128M ...
Using CATALINA_PID: /opt/tomcat/work/catalina.pid
Server version: Apache Tomcat/10.1.28
Server built: Aug 2 2024 15:14:43 UTC
Server number: 10.1.28.0
OS Name: Linux
OS Version: 5.15.0-134-generic
Architecture: amd64
JVM Version: 17.0.14+7
JVM Vendor: Eclipse Adoptium
Why doesn't the CATALINA_PID point to sst like "/run/..." (which is a tmpfs and empty after reboot)?
The systemctl servicefile runs the commands as user "tomcat" so it can't create "/run/tomcat/".
As far as I can see, there are two bad options (with a common core) and a third really ugly one:
Let CATALINA_PID point to "/run/tomcat/catalina.pid" and create the dir in advance writable for tomcat.tomcat
Delete the /opt/tomcat/work/catalina.pid after reboot deterministic before Tomcat starts.
Rewrite the startingprocess according to FSH and systemd "standard"
(uaf): Check after reboot, if (Tomcat is enabled and Tomcat not running and pid is older than uptime), removing pid and starting Tomcat.
Any other suggestions or ideas for a general solution?
Share Improve this question edited Mar 21 at 20:50 andrewJames 22.1k11 gold badges30 silver badges65 bronze badges asked Mar 21 at 12:35 maniac_on_moonmaniac_on_moon 1492 silver badges7 bronze badges 01 Answer
Reset to default 0Solution: Deviate from Tomcat default and use "tmpfiles.d"
echo "d /run/tomcat 0755 tomcat tomcat -" | sudo bash -c "cat - > /etc/tmpfiles.d/tomcat.conf"
sudo systemd-tmpfiles --create
point
CATALINA_PID="/run/tomcat/catalina.pid"
and restart Tomcat.
Other references with similar issues and no (reliable) solution:
first
second
third
fourth
(Thanks to @andrewJames for editing)
本文标签: linuxTomcat did not restart after reboot due to existing PID file on ubuntu 2204Stack Overflow
版权声明:本文标题:linux - Tomcat did not restart after reboot due to existing PID file on ubuntu 22.04 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744353703a2602197.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论