tomcat works but service tomcat status says it failed
40,919
Solution 1
I have referred this answer and giving tomcat user ownership of the whole tomcat directory worked for me
cd /opt && sudo chown -R tomcat tomcat/
Solution 2
Here's an error:
Environment='JAVA_OPTS=-Djava.awt.headless=true - Djava.security.egd=file:/dev/./urandom'
^^
Remove those two spaces.
Related videos on Youtube
Author by
Evan Briones
Updated on September 18, 2022Comments
-
Evan Briones over 1 year
This is my tomcat.service file, located at etc/systemd/system
[root@ip-10-81-27-248 system]# less tomcat.service Systemd unit file for tomcat [Unit] Description=Apache Tomcat Web Application Container After=syslog.target network.target [Service] Type=forking SuccessExitStatus=143 Environment=TOMCAT_JAVA_HOME=/usr/java/latest/jre Environment=JAVA_HOME=/usr/java/latest/jre Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid Environment=CATALINA_HOME=/opt/tomcat Environment=CATALINA_BASE=/opt/tomcat Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC' Environment='JAVA_OPTS=-Djava.awt.headless=true - Djava.security.egd=file:/dev/./urandom' ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/bin/kill -15 $MAINPID User=tomcat Group=tomcat [Install] WantedBy=multi-user.target
now when i check the status of my tomcat it says
ExecStop=/bin/kill -15 $MAINPID (code=exited, status=1/FAILURE)
[root@ip-10-81-27-248 system]# service tomcat status -l Redirecting to /bin/systemctl status -l tomcat.service ● tomcat.service - Apache Tomcat Web Application Container Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Tue 2017-04-25 02:43:57 UTC; 6min ago Process: 16187 ExecStop=/bin/kill -15 $MAINPID (code=exited, status=1/FAILURE) Process: 16154 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=0/SUCCESS) Main PID: 16164 (code=exited, status=0/SUCCESS) Apr 25 02:43:54 ip-10-81-27-248.us-west-2.compute.internal systemd[1]: Starting Apache Tomcat Web Application Container... Apr 25 02:43:54 ip-10-81-27-248.us-west-2.compute.internal startup.sh[16154]: Existing PID file found during start. Apr 25 02:43:54 ip-10-81-27-248.us-west-2.compute.internal startup.sh[16154]: Removing/clearing stale PID file. Apr 25 02:43:54 ip-10-81-27-248.us-west-2.compute.internal startup.sh[16154]: Tomcat started. Apr 25 02:43:54 ip-10-81-27-248.us-west-2.compute.internal systemd[1]: Started Apache Tomcat Web Application Container. Apr 25 02:43:57 ip-10-81-27-248.us-west-2.compute.internal systemd[1]: tomcat.service: control process exited, code=exited status=1 Apr 25 02:43:57 ip-10-81-27-248.us-west-2.compute.internal systemd[1]: Unit tomcat.service entered failed state. Apr 25 02:43:57 ip-10-81-27-248.us-west-2.compute.internal systemd[1]: tomcat.service failed.
i tried using service tomcat restart but it still says tomcat service failed. what may be the cause this?
-
Shailesh Sutar over 5 yearsDid you look at this answer unix.stackexchange.com/questions/235891/…
-