Actions
Defect #1519
closedTomcat failed to start on OS restart
Status:
Closed
Priority:
Normal
Assignee:
Luděk Urban
Category:
Infrastructure
Target version:
-
Start date:
02/19/2019
Due date:
% Done:
100%
Estimated time:
Affected versions:
Owner:
Description
System: CentOS 7.6.1810 x86-64
Aplication server: Apache Tomcat 8.5.37¶
While system restarts or service restarts tomcat started and immediately stopped.
Log in "/var/log/messages" looks like this:
Feb 19 12:38:25 idmtest systemd: Starting Apache Tomcat Web Application Container... Feb 19 12:38:25 idmtest startup.sh: Using CATALINA_BASE: /opt/tomcat/current Feb 19 12:38:25 idmtest startup.sh: Using CATALINA_HOME: /opt/tomcat/current Feb 19 12:38:25 idmtest startup.sh: Using CATALINA_TMPDIR: /opt/tomcat/current/temp Feb 19 12:38:25 idmtest startup.sh: Using JRE_HOME: /usr/lib/jvm/java-openjdk Feb 19 12:38:25 idmtest startup.sh: Using CLASSPATH: /opt/czechidm/etc:/opt/czechidm/lib/*:/opt/tomcat/current/bin/bootstrap.jar:/opt/tomcat/current/bin/tomcat-juli.jar Feb 19 12:38:25 idmtest startup.sh: Using CATALINA_PID: /opt/tomcat/current/temp/tomcat.pid Feb 19 12:38:25 idmtest startup.sh: Tomcat started. Feb 19 12:38:25 idmtest systemd: Started Apache Tomcat Web Application Container. Feb 19 12:38:25 idmtest shutdown.sh: Using CATALINA_BASE: /opt/tomcat/current Feb 19 12:38:25 idmtest shutdown.sh: Using CATALINA_HOME: /opt/tomcat/current Feb 19 12:38:25 idmtest shutdown.sh: Using CATALINA_TMPDIR: /opt/tomcat/current/temp Feb 19 12:38:25 idmtest shutdown.sh: Using JRE_HOME: /usr/lib/jvm/java-openjdk Feb 19 12:38:25 idmtest shutdown.sh: Using CLASSPATH: /opt/czechidm/etc:/opt/czechidm/lib/*:/opt/tomcat/current/bin/bootstrap.jar:/opt/tomcat/current/bin/tomcat-juli.jar Feb 19 12:38:25 idmtest shutdown.sh: Using CATALINA_PID: /opt/tomcat/current/temp/tomcat.pid Feb 19 12:38:26 idmtest shutdown.sh: Úno 19, 2019 12:38:26 ODP. org.apache.catalina.startup.Catalina stopServer Feb 19 12:38:26 idmtest shutdown.sh: SEVERE: No shutdown port configured. Shut down server through OS signal. Server not shut down. Feb 19 12:38:26 idmtest shutdown.sh: The stop command failed. Attempting to signal the process to stop through OS signal. Feb 19 12:38:27 idmtest shutdown.sh: Tomcat stopped.
cause:
Probably, systemd is not able to distinguish if the tomcat started at all so it immediatelly tries to stop it.¶
solution:¶
Add following line to tomcat.service. This will cause systemd to lookup tomcat's PID file.
PIDFile=/opt/tomcat/current/temp/tomcat.pid
In "/var/log/messages" you may now find this line:
úno 19 13:22:51 idmtest systemd[1]: PID file /opt/tomcat/current/temp/tomcat.pid not readable (yet?) after start.
This happens because system expect pid file but tomcat didn't make any yet. It is not a problem.
Actions