pid文件,但未找到匹配的进程,或者当前用户没有停止进程的权限

jvlzgdj9  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(376)

我面临着ApacheTomcat9.0.50、ubuntu服务器18.04LTS和JavaJDK8的问题。
我无法将tomcat9作为服务启动,因为如果我在启动后检查其状态,它会显示错误:找到了pid文件,但没有找到匹配的进程,或者当前用户没有停止进程的权限。停止中止。
我已经为tomcat创建了一个专用组和用户(组tomcat9,用户tomcat9)。
如果我检查ps(process show)linux工具,例如:

ps -faux | grep tomcat

tomcat不存在,因此进程未处于活动状态。
我正在运行sudo systemctl start tomcat.service
使用属于sudoers和tomcat9组的“sadmin”帐户。

Jul 06 17:14:55 i-s-023 systemd[1]: Starting Tomcat9...
Jul 06 17:14:55 i-s-023 startup.sh[5257]: Existing PID file found during start.
Jul 06 17:14:55 i-s-023 startup.sh[5257]: Removing/clearing stale PID file.
Jul 06 17:14:55 i-s-023 startup.sh[5257]: Tomcat started.
Jul 06 17:14:55 i-s-023 shutdown.sh[5279]: PID file found but either no matching process was found or the current user does not have permission to stop the process. Stop aborted.
Jul 06 17:14:55 i-s-023 systemd[1]: tomcat.service: Control process exited, code=exited status=1
Jul 06 17:14:55 i-s-023 systemd[1]: tomcat.service: Failed with result 'exit-code'.
Jul 06 17:14:55 i-s-023 systemd[1]: Failed to start Tomcat9.

这是我的/opt文件夹:

drwxr-xr-x  4 root    root        4096 Jul  6 14:44 .
drwxr-xr-x 24 root    root        4096 Jun 24 01:26 ..
drwxr-xr-x  9 tomcat9 tomcat9     4096 Jul  6 16:43 apache-tomcat-9.0.50
-rw-r--r--  1 root    root    11507318 Jun 28 10:52 apache-tomcat-9.0.50.tar.gz
drwxr-xr-x  7 root    root        4096 Jul  6 16:34 jdk1.8.0_221
lrwxrwxrwx  1 root    root          20 Jul  6 14:44 tomcat-latest -> apache-tomcat-9.0.50

这些是/opt/tomcat最新文件夹中的权限

drwxr-xr-x 9 tomcat9 tomcat9  4096 Jul  6 16:43 .
drwxr-xr-x 4 root    root     4096 Jul  6 14:44 ..
drwxrwx--- 2 root    tomcat9  4096 Jul  6 14:44 bin
-rw-r----- 1 root    tomcat9 18949 Jun 28 10:46 BUILDING.txt
drwxr-x--- 2 root    tomcat9  4096 Jun 28 10:46 conf
-rw-r----- 1 root    tomcat9  6210 Jun 28 10:46 CONTRIBUTING.md
drwxr-x--- 2 root    tomcat9  4096 Jul  6 14:44 lib
-rw-r----- 1 root    tomcat9 57092 Jun 28 10:46 LICENSE
drwxr-x--- 2 tomcat9 tomcat9  4096 Jul  6 14:46 logs
-rw-r----- 1 root    tomcat9  2333 Jun 28 10:46 NOTICE
-rw-r----- 1 root    tomcat9  3372 Jun 28 10:46 README.md
-rw-r----- 1 root    tomcat9  6898 Jun 28 10:46 RELEASE-NOTES
-rw-r----- 1 root    tomcat9 16507 Jun 28 10:46 RUNNING.txt
drwxr-x--- 2 tomcat9 tomcat9  4096 Jul  6 17:14 temp
drwxr-x--- 7 tomcat9 tomcat9  4096 Jun 28 10:46 webapps
drwxr-x--- 2 tomcat9 tomcat9  4096 Jun 28 10:46 work

服务的定义如下所示:

[Unit]
Description=Tomcat9
After=network.target

[Service]
Type=forking
User=tomcat9
Group=tomcat9
WorkingDirectory=/opt/tomcat-latest/bin
Environment=CATALINA_PID=/opt/tomcat-latest/temp/tomcat9.pid
Environment=JAVA_HOME=/opt/jdk1.8.0_221
Environment=CATALINA_HOME=/opt/tomcat-latest
Environment=CATALINA_BASE=/opt/tomcat-latest
Environment="CATALINA_OPTS=-Xms1280m -Xmx3840m"
Environment="JAVA_OPTS=-Dfile.encoding=UTF-8 -Dnet.sf.ehcache.skipUpdateCheck=true -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC  -Dorg.apache.tomcat.util.buf.UDec$

ExecStart=/opt/tomcat-latest/bin/startup.sh
ExecStop=/opt/tomcat-latest/bin/shutdown.sh

[Install]
WantedBy=multi-user.target

你有什么建议吗?提前谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题