gpt4 book ai didi

linux - Tomcat9 在步骤 NAMESPACE 失败

转载 作者:行者123 更新时间:2023-12-02 19:39:19 25 4
gpt4 key购买 nike

我的操作系统是 Debian 10 (Buster),4.19 内核,Tomcat9 似乎不稳定。

我不想在运行“systemctl status tomcat9.service”命令时看到任何错误消息。

但是,“systemctl status tomcat9.service”命令会打印一条错误消息。

● tomcat9.service - Apache Tomcat 9 Web Application Server
Loaded: loaded (/lib/systemd/system/tomcat9.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2020-03-03 21:02:15 KST; 12min ago
Docs: https://tomcat.apache.org/tomcat-9.0-doc/index.html
Process: 25999 ExecStartPre=/usr/libexec/tomcat9/tomcat-update-policy.sh (code=exited, status=226/NAMESPACE)

Mar 03 21:02:15 doonas.com systemd[1]: Starting Apache Tomcat 9 Web Application Server...
Mar 03 21:02:15 doonas.com systemd[25999]: tomcat9.service: Failed to set up mount namespacing: No such file or directory
Mar 03 21:02:15 doonas.com systemd[25999]: tomcat9.service: Failed at step NAMESPACE spawning /usr/libexec/tomcat9/tomcat-update-policy.sh
Mar 03 21:02:15 doonas.com systemd[1]: tomcat9.service: Control process exited, code=exited, status=226/NAMESPACE
Mar 03 21:02:15 doonas.com systemd[1]: tomcat9.service: Failed with result 'exit-code'.
Mar 03 21:02:15 doonas.com systemd[1]: Failed to start Apache Tomcat 9 Web Application Server.

但是,尽管有错误消息,我已确认网页正常运行。

我不知道为什么会这样。

我试图解决这个问题。

  1. shutdown.sh、startup.sh已经激活。

但是,还是不行。

root@doonas:/usr/share/tomcat9/bin# bash shutdown.sh
Using CATALINA_BASE: /usr/share/tomcat9
Using CATALINA_HOME: /usr/share/tomcat9
Using CATALINA_TMPDIR: /usr/share/tomcat9/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/share/tomcat9/bin/bootstrap.jar:/usr/share/tomcat9/bin/tomcat-juli.jar
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/jav a.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Mar 03, 2020 9:14:13 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: No shutdown port configured. Shut down server through OS signal. Server not shut down.
root@doonas:/usr/share/tomcat9/bin# bash startup.sh
Using CATALINA_BASE: /usr/share/tomcat9
Using CATALINA_HOME: /usr/share/tomcat9
Using CATALINA_TMPDIR: /usr/share/tomcat9/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/share/tomcat9/bin/bootstrap.jar:/usr/share/tomcat9/bin/tomcat-juli.jar
Tomcat started.
  1. 我引用 this link 修改了符号链接(symbolic link).

他说“Tomcat 被 systemd 沙盒化了,只能对以下目录进行写访问”

但是,还是不行。

root@doonas:/var/lib/tomcat9# ls -l
total 12
drwxr-xr-x 2 root root 4096 Mar 3 21:00 conf
drwxr-xr-x 2 tomcat tomcat 4096 Jun 14 2019 lib
lrwxrwxrwx 1 root root 16 Mar 3 20:48 logs -> /var/log/tomcat9
drwxr-xr-x 2 root root 4096 Feb 18 13:31 policy
lrwxrwxrwx 1 root root 19 Mar 3 20:48 work -> /var/cache/tomcat9/
root@doonas:/var/lib/tomcat9# ls -l conf/Catalina
lrwxrwxrwx 1 root root 21 Mar 3 21:00 conf/Catalina -> /etc/tomcat9/Catalina

这是我的 Tomcat9 信息。

CATALINA_BASE 是/usr/share/tomcat9。

root@doonas:/usr/share/tomcat9# ls -l
total 24
drwxr-xr-x 2 root root 4096 Feb 17 10:37 bin
lrwxrwxrwx 1 root root 13 Mar 3 21:14 conf -> /etc/tomcat9/
-rw-r--r-- 1 root root 1017 Jun 3 2019 default.template
drwxr-xr-x 2 root root 4096 Feb 17 10:37 etc
drwxr-xr-x 2 root root 4096 Feb 17 10:37 lib
-rw-r--r-- 1 root root 133 Apr 1 2019 logrotate.template
lrwxrwxrwx 1 root root 21 Mar 3 21:10 logs -> /var/lib/tomcat9/logs
lrwxrwxrwx 1 root root 23 Mar 3 21:10 policy -> /var/lib/tomcat9/policy
drwxr-xr-x 5 root root 4096 Feb 17 10:37 skel
lrwxrwxrwx 1 root root 21 Mar 3 21:10 work -> /var/lib/tomcat9/work
root@doonas:/usr/share/tomcat9# ls -l /etc/tomcat9/
total 208
drwxrwxr-x 3 root tomcat 4096 Feb 18 13:26 Catalina
-rw-r----- 1 root tomcat 7483 Feb 4 2019 catalina.properties
-rw-r----- 1 root tomcat 1400 Jul 5 2017 context.xml
-rw-r----- 1 root tomcat 1149 Nov 21 2017 jaspic-providers.xml
-rw-r----- 1 root tomcat 2799 Jun 14 2019 logging.properties
drwxr-xr-x 2 root tomcat 4096 Feb 17 10:37 policy.d
-rw-r----- 1 root tomcat 7638 Feb 18 13:08 server.xml
-rw-r----- 1 root tomcat 2286 Feb 18 10:49 tomcat-users.xml
-rw-r----- 1 root tomcat 170202 Nov 18 2017 web.xml
root@doonas:/usr/share/tomcat9# ls -l /var/lib/tomcat9/
total 12
drwxr-xr-x 2 root root 4096 Mar 3 21:00 conf
drwxr-xr-x 2 tomcat tomcat 4096 Jun 14 2019 lib
lrwxrwxrwx 1 root root 16 Mar 3 20:48 logs -> /var/log/tomcat9
drwxr-xr-x 2 root root 4096 Feb 18 13:31 policy
lrwxrwxrwx 1 root root 19 Mar 3 20:48 work -> /var/cache/tomcat9/
root@doonas:/usr/share/tomcat9# ls -l /etc/tomcat9/
Catalina/ context.xml logging.properties server.xml web.xml
catalina.properties jaspic-providers.xml policy.d/ tomcat-users.xml

最佳答案

错误消息不是来自 tomcat,而是来自 systemd。此非特定消息 ( GitHub Issue 10972 ) 已通过 Systemd 243 修复。

问题是什么:在单元文件中指定了选项 ReadWritePath=,但文件夹/路径不存在。

要修复此问题,请运行 systemctl cat tomcat9 以获取单元文件的完整内容以及所有可能存在的覆盖文件。然后使用 ReadWritePath= 检查所有行并确保指定的目录确实存在。

关于linux - Tomcat9 在步骤 NAMESPACE 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60508229/

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