gpt4 book ai didi

ubuntu-16.04 - 设置了 CATALINA_PID 但指定的文件不存在

转载 作者:行者123 更新时间:2023-12-05 07:25:20 25 4
gpt4 key购买 nike

我按照本指南在 Ubuntu 16.04.2 LTS Xenial ( https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04) 上设置 tomcat。

到了第一次发射的地步:

sudo systemctl start tomcat

并收到一个错误:

~$ 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.

journalctl -xe
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit tomcat.service has begun starting up.
Feb 27 15:23:42 76672.local startup.sh[20551]: Tomcat started.
Feb 27 15:23:42 76672.local shutdown.sh[20563]: $CATALINA_PID was set but the specified file does not exist. Is Tomcat running? Stop aborted.
Feb 27 15:23:42 76672.local systemd[1]: tomcat.service: Control process exited, code=exited status=1
Feb 27 15:23:42 76672.local systemd[1]: Failed to start Tomcat 9 servlet 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.

CATALINA_PID 预计位于目录 /opt/tomcat/latest/temp/tomcat.pid

我授权为这个目录 /opt/tomcat 和所有子文件夹/文件做所有事情:

~$ namei -l /opt/tomcat
f: /opt/tomcat
drwxr-xr-x root root /
drwxr-xr-x root root opt
drwxrwxrwx tomcat tomcat tomcat

有谁能指出可能的解决方案吗?

更新:使用 bin/startup.sh Tomcat 成功启动。

最佳答案

当您在 tomcat.service 文件中使用 CATALINA_PID 时,请确保使用双引号内的路径。

Environment="CATALINA_PID=/opt/tomcat/latest/temp/tomcat.pid" 

如下图


[Unit]
Description=Tomcat 9 servlet container
After=network.target

[Service]
Type=forking

User=tomcat
Group=tomcat

Environment="/usr/lib/jvm/java-1.8.0-openjdk-amd64"
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom -Djava.awt.headless=true"

Environment="CATALINA_BASE=/opt/tomcat/"
Environment="CATALINA_HOME=/opt/tomcat/"
Environment="CATALINA_PID=/opt/tomcat/temp/tomcat.pid"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"

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

[Install]
WantedBy=multi-user.target

恭喜!

关于ubuntu-16.04 - 设置了 CATALINA_PID 但指定的文件不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54910487/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com