我正在尝试在 Google 云服务器上启动 Apache Tomcat。这是一台 CentOS 7 服务器,上面有 Apache Tomcat 8。说明如下https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-centos-7但当我到达:
sudo systemctl start tomcat
我收到消息:
Job for tomcat.service failed because the control process exited with error code. See "systemctl status tomcat.service" and "journalctl -xe" for details.
对于 systemctl status tomcat.service 我得到:
tomcat.service - Apache Tomcat Web Application Container
Loaded: loaded (/etc/systemd/system/tomcat.service; disabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since Fri 2017-12-29 17:04:47 UTC; 639ms ago
Process: 3526 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=203/EXEC)
Dec 29 17:04:47 jira-dev systemd[1]: Unit tomcat.service entered failed state.
Dec 29 17:04:47 jira-dev systemd[1]: tomcat.service failed.
对于 journalctl -xe 我无法发布全部内容,因为它“看起来像垃圾邮件”,但我得到:
-- The error number returned by this process is 13.
Dec 29 16:55:33 jira-dev systemd[1]: tomcat.service: control process exited, code=exited status=203
Dec 29 16:55:33 jira-dev systemd[1]: Failed to start Apache Tomcat Web Application Container.
-- Subject: Unit tomcat.service has failed
-- Defined-By: systemd
和
-- The result is failed.
Dec 29 16:55:33 jira-dev systemd[1]: Unit tomcat.service entered failed state.
Dec 29 16:55:33 jira-dev systemd[1]: tomcat.service failed.
Dec 29 16:55:44 jira-dev systemd[1]: tomcat.service holdoff time over, scheduling restart.
Dec 29 16:55:44 jira-dev systemd[1]: Starting Apache Tomcat Web Application Container...
-- Subject: Unit tomcat.service has begun start-up
-- Defined-By: systemd
和
-- Unit tomcat.service has begun starting up. Dec 29 16:55:44 jira-dev systemd[3317]: Failed at step EXEC spawning /opt/tomcat/bin/startup.sh: Permission denied
-- Subject: Process /opttomcat/bin/startup.sh could not be executed
-- Defined-By: systemd/
和
-- The error number returned by this process is 13.
Dec 29 16:55:44 jira-dev systemd[1]: tomcat.service: control process exited, code=exited status=203
Dec 29 16:55:44 jira-dev systemd[1]: Failed to start Apache Tomcat Web Application Container.
-- Subject: Unit tomcat.service has failed
-- Defined-By: systemd
/etc/system/system/tomcat.service 文件看起来像说明中的文件。
我也设置了JAVA_HOME
,以防万一。
我看到了权限错误,但我已经按照以下说明授予 tomcat 用户 tomcat 目录的所有权:CentOs 7.1 - 安装 Tomcat 8与command cd /opt && sudo chown -R tomcat tomcat/
我也尝试过注释掉Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
tomcat.service 文件中的该行,但是没有帮助,所以我取消了对它的注释。
我以 root 身份运行。
答案1
因为我来到这里花了好几个小时才弄清楚
错误信息
systemd[5189]: 步骤 EXEC 生成 /opt/tomcat/bin/startup.sh 失败: 权限被拒绝
我通过授予 bin 文件夹执行权限解决了这个问题。