Tomcat 服務失敗

Tomcat 服務失敗

您好,我正在嘗試運行 Apache tomcat 的狀態,但一直失敗。這就是我得到的

tomcat.service - Tomcat 10 configuration file
     Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; preset: disabled)
     Active: failed (Result: exit-code) since Thu 2023-09-07 13:02:48 EDT; 53min ago
        CPU: 3ms

Sep 07 13:02:48 server1.example.com systemd[1]: Starting Tomcat 10 configuration file...
Sep 07 13:02:48 server1.example.com systemd[1263]: tomcat.service: Failed to locate executable /usr/local/tomcat10-server/bin/catalina.sh: Permission denied
Sep 07 13:02:48 server1.example.com systemd[1263]: tomcat.service: Failed at step EXEC spawning /usr/local/tomcat10-server/bin/catalina.sh: Permission denied
Sep 07 13:02:48 server1.example.com systemd[1]: tomcat.service: Control process exited, code=exited, status=203/EXEC
Sep 07 13:02:48 server1.example.com systemd[1]: tomcat.service: Failed with result 'exit-code'.
Sep 07 13:02:48 server1.example.com systemd[1]: Failed to start Tomcat 10 configuration file.

我的奈米文件/etc/systemd/system/tomcat.service是:

[Unit]
Description=Tomcat 10 configuration file
After=syslog.target network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
Environment=JAVA_HOME=/usr/lib/jvm/jre-17-openjdk
Environment='JAVA_OPTS=-Djava.awt.headless=true'
Environment=CATALINA_HOME=/usr/local/tomcat10-server
Environment=CATALINA_BASE=/usr/local/tomcat10-server
Environment=CATALINA_PID=/usr/local/tomcat10-server/temp/tomcat.pid
ExecStart=/usr/local/tomcat10-server/bin/catalina.sh start
ExecStop=/usr/local/tomcat10-server/bin/catalina.sh stop
[Install]
WantedBy=multi-user.target

我該如何解決這個問題才能不失敗?

答案1

您的錯誤訊息在 catalina.sh 上顯示「權限被拒絕」。請驗證該文件是否可執行並且也歸tomcat您在服務文件中指定的使用者所有。

相關內容