Defect #1519
Updated by Petr Fišer about 5 years ago
h3. 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" "/war/log/messages" looks like this: <pre> 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. </pre> h3. cause: Probably, systemd is not able to distinguish if the tomcat started at all so it immediatelly tries to stop it. h3. solution: Add following this line to tomcat.service. This will cause systemd to lookup tomcat's PID file. tomcat.service . <pre> PIDFile=/opt/tomcat/current/temp/tomcat.pid </pre> In "/var/log/messages" "/war/log/messages" you may now find this line: <pre> úno 19 13:22:51 idmtest idmtest.fnhk.cz systemd[1]: PID file /opt/tomcat/current/temp/tomcat.pid not readable (yet?) after start. </pre> This happens because system expect pid file but tomcat didn't make any yet. It is not a problem.