web-dev-qa-db-ja.com

tomcatは機能しますが、サービスTomcatステータスは失敗と表示します

これは、etc/systemd/systemにある私のTomcat.serviceファイルです。

[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

tomcatのステータスを確認すると、

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.

tomcatサービスの再起動を使用してみましたが、Tomcatサービスが失敗したと表示されます。これの原因は何ですか?

2
Evan Briones

私は この答え を参照し、Tomcatディレクトリ全体の所有権をTomcatユーザーに与えるとうまくいきました

cd /opt && Sudo chown -R Tomcat tomcat/

1
Sagar Ajmire

ここにエラーがあります:

Environment='Java_OPTS=-Djava.awt.headless=true -  Djava.security.egd=file:/dev/./urandom'
                                                 ^^

それら2つのスペースを削除します。

1
Jenny D