无法启动tomcat服务9.0.48,继续抛出“找到pid文件,但未找到匹配进程或当前用户没有..”

cgyqldqp  于 2021-10-10  发布在  Java
关注(0)|答案(1)|浏览(362)

我刚把我的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 每次创业之后?正如您在上面的错误中所看到的,我运行了start service命令,但得到了一个shutdown错误。
如果我注解掉或删除 ExecStop 从systemd tomcat单元文件中,启动不再引发错误,但仍处于非活动状态(从 sytemctl status tomcat )
我已经在这里看到错误报告很多次了,但是没有任何建议解决了我的问题。

xbp102n0

xbp102n01#

发现了问题。
是的 JAVA_HOME tomcat单元服务中的配置错误,因为我还更新了lic服务器上的java版本,但给出了一个过时的jre路径
通过手动测试tomcat启动srcipt发现了它,所以我通过更改行来更新服务单元
environment=java_home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64

environment=“java_home=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64”
现在一切都很好。

相关问题