我正在尝试在centos-release-7-4.1708.el7.centos.x86_64中运行tomcat 7
以下是以下步骤:
yum install java-1.7.0-openjdk-devel java-1.7.0-openjdk
测试是否已安装:
echo $JAVA_HOME
/usr/java/jdk/
echo $JRE_HOME
/usr/java/jdk/jre
安装tomcat 7
yum install tomcat tomcat-webapps tomcat-admin-webapps
systemctl stop tomcat
systemctl start tomcat
systemctl enable tomcat
它应该为tomcat.service创建一个符号链接,但是没有......
systemctl status tomcat
tomcat.service - Apache Tomcat Web Application Container
Loaded: loaded (/usr/lib/systemd/system/tomcat.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2017-11-13 10:26:33 WET; 4min 7s ago
Process: 2825 ExecStart=/usr/libexec/tomcat/server start (code=exited, status=127)
Main PID: 2825 (code=exited, status=127)
systemd[1]: Started Apache Tomcat Web Application Container.
systemd[1]: Starting Apache Tomcat Web Application Container...
server[2825]: /usr/libexec/tomcat/server: Failed to set JAVACMD
systemd[1]: tomcat.service: main process exited, code=exited, status=127/n/a
systemd[1]: Unit tomcat.service entered failed state.
systemd[1]: tomcat.service failed.
更新1
/ usr / lib / systemd / system
中的文件tomcat.service的内容# Systemd unit file for default tomcat
#
# To create clones of this service:
# DO NOTHING, use tomcat@.service instead.
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target
[Service]
Type=simple
EnvironmentFile=/etc/tomcat/tomcat.conf
Environment="NAME="
EnvironmentFile=-/etc/sysconfig/tomcat
ExecStart=/usr/libexec/tomcat/server start
SuccessExitStatus=143
User=tomcat
Group=tomcat
[Install]
WantedBy=multi-user.target
答案 0 :(得分:0)
用/ usr / java / jdk /
替换/etc/tomcat/tomcat.conf中的JAVA_HOME答案 1 :(得分:0)
服务器升级后,我曾经遇到过这种情况。我调试了脚本,并在检查java文件是否可执行时失败。所以我不得不将ExecStart更改为类似的方式,并且有效
ExecStart=/bin/bash /usr/libexec/tomcat/server start