【发布时间】:2021-06-15 21:27:02
【问题描述】:
我刚刚将我的 tomcat 更新为 9.0.48,但它总是无法启动。
我尝试了一切,删除了 pid 文件,禁用/启用了服务,停止了 tomcat,....但无法启动。它不断从我截断的journalctl -xe 输出中抛出这个错误:
找到 PID 文件但没有找到匹配的进程或当前 用户无权停止该进程。停止中止
=>>
--
-- Unit tomcat.service has begun starting up.
Jun 15 21:07:55 infra-vm startup.sh[63077]: Existing PID file found during start.
Jun 15 21:07:55 infra-vm startup.sh[63077]: Removing/clearing stale PID file.
Jun 15 21:07:55 infra-vm startup.sh[63077]: Tomcat started.
Jun 15 21:07:55 infra-vm shutdown.sh[63089]: PID file found but either no matching process was found or the current user does not have permission to stop the process. Stop aborted.
Jun 15 21:07:55 infra-vm systemd[1]: tomcat.service: control process exited, code=exited status=1
Jun 15 21:07:55 infra-vm systemd[1]: Failed to start Apache Tomcat Web Application Container.
-- Subject: Unit tomcat.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit tomcat.service has failed.
--
-- The result is failed.
Jun 15 21:07:55 infra-vm systemd[1]: Unit tomcat.service entered failed state.
Jun 15 21:07:55 infra-vm systemd[1]: tomcat.service failed.
Jun 15 21:07:55 infra-vm polkitd[841]: Unregistered Authentication Agent for unix-process:63063:8684558 (system bus name :1.714, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Jun 15 21:07:55 infra-vm sudo[63061]: pam_unix(sudo:session): session closed for user root
这是我的服务单位:
# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64
#Environment=CATALINA_PID=/opt/tomcat/updated/temp/tomcat.pid
Environment=CATALINA_PID=/opt/tomcat/updated/temp/catalina.pid
Environment=CATALINA_HOME=/opt/tomcat/updated/
Environment=CATALINA_BASE=/opt/tomcat/updated/
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
ExecStart=/opt/tomcat/updated/bin/startup.sh
ExecStop=/opt/tomcat/updated/bin/shutdown.sh
User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
为什么服务在每次启动后都会执行shutdown?正如你在上面的错误中看到的,我运行了启动服务命令但得到了一个关机错误。
如果我从 systemd 的 tomcat 单元文件中注释掉或删除 ExecStop,则 start 不再引发错误,但仍处于非活动状态(来自 sytemctl status tomcat)
看到这里报错很多次了,但没有任何建议解决我的问题。
【问题讨论】: