服务tomcat7启动失败,但进程存在,tomcat正在运行 [英] service tomcat7 start fails, but the process exists and tomcat is running
问题描述
我一直在尝试使用 apt-get install tomcat7
在ubuntu docker映像上安装tomcat7。
安装工作正常,并从catalina.sh启动tomcat。
我需要从service tomcat7 start启动tomcat,而不是。
无论如何,如果我 wget localhost:8080
我可以看到tomcat的回答,如果我 ps -ef | grep tomcat
我可以看到这个过程。
同样,如果我运行服务tomcat7 status
它表示tomcat不运行,即使是,而 PID 文件确实存在。
我注意到,当我从catalina脚本,创建的pid文件称为 tomcat.pid ,但 /etc/init.d/tomcat
脚本将尝试阅读 tomcat7.pid 。
但是,强制脚本中的名称来窥视正确的pid文件,不能解决问题。
有没有人经历过这个?
我正在尝试的docker文件的ubuntu版本并不真正相关,因为我有一直在尝试几个。
无论如何,我主要使用的是 12.10 和 14.04 。
谢谢!
在Docker Ubuntu镜像我正在使用(5506de2b643b - 14.04 .1 LTS ),具有 - test
参数的start-stop-daemon工作不正确,并报告tomcat没有运行,即使是这样。
tomcat7 init.d脚本启动tomcat,因为 start-stop-daemon --test
说(正确)tomcat没有运行,但稍后在启动过程中,它会检查tomcat是否已成功启动并正在运行。 start-stop-daemon --test
现在不正确地说tomcat没有运行,这导致tomcat7 init.d脚本删除PID文件。
因此,当tomcat运行时,由于PID文件已经消失,服务tomcat7 status
返回false即使PID文件由于 start-stop-daemon --test
中的错误而返回false。
以下是一个演示该错误的示例会话:
#TOMCAT PID IS 43
root @ a2cf26ade2a9: /#ps -eaf | grep tomcat7
tomcat7 43 1 0 14:06? 00:00:04 / usr / lib / jvm / java-7-oracle / bin / java -Djava.util.logging.config.file = / var / lib / tomcat7 / conf / logging.properties -Djava.util.logging .manager = org.apache.juli.ClassLoaderLogManager -Djava.awt.headless = true -Xmx128m -XX:+ UseConcMarkSweepGC -Djava.endorsed.dirs = / usr / share / tomcat7 / endorsed -classpath / usr / share / tomcat7 / bin /bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar -Dcatalina.base = / var / lib / tomcat7 -Dcatalina.home = / usr / share / tomcat7 -Djava.io.tmpdir = / tmp / tomcat7-tomcat7-tmp org.apache.catalina.startup.Bootstrap start
#PID FILE HAS CORRECT PID
root @ a2cf26ade2a9:/#cat /var/run/tomcat7.pid
43
#START-STOP-DAEMON - 要启动TOMCAT的报告
root @ a2cf26ade2a9:/#start-stop-daemon --test --start - pidfile /var/run/tomcat7.pid --user tomcat7 --exec / usr / lib / jvm / java-7-oracle / bin / java
将启动/ usr / lib / jvm / java-7-oracle / bin / java。
root @ a2cf26ade2a9:/#echo $?
0
I have been trying to install tomcat7 on ubuntu docker images with apt-get install tomcat7
.
The installation works fine and starting tomcat from the catalina.sh works as well.
I need to start tomcat from "service tomcat7 start", which instead fails.
Regardless the failure result, if I wget localhost:8080
I can see tomcat answering and if I ps -ef | grep tomcat
I can see the process.
Similarly if I run service tomcat7 status
it says the tomcat is not running even when it is and the PID file does exist.
I have noticed that when I start tomcat from the catalina scripts, the pid file created is called tomcat.pid, but the /etc/init.d/tomcat
script would try to read tomcat7.pid.
However, forcing the name in the script to peek up the right pid file, does not solve the problem.
Has anyone else experienced this?
The ubuntu version of the docker file I am trying is not really relevant, since I have been trying with several.
Anyway the one I am mostly using are 12.10 and 14.04.
Thanks!
In the docker Ubuntu image I am using (5506de2b643b - 14.04.1 LTS), the start-stop-daemon with the --test
argument is working incorrectly and reports that tomcat is not running, even when it is.
The tomcat7 init.d script starts tomcat because start-stop-daemon --test
says (correctly) tomcat is not running, but then a little later in the startup process it checks that tomcat started successfully and is running. start-stop-daemon --test
now incorrectly says tomcat is not running, which causes the tomcat7 init.d script to remove the PID file.
As a result, service tomcat7 status
returns false when tomcat is running because the PID file is gone, but it will return false even if the PID file is there with correct PID due to the bug in start-stop-daemon --test
.
Here's an example session demonstrating the bug:
#TOMCAT PID IS 43
root@a2cf26ade2a9:/# ps -eaf | grep tomcat7
tomcat7 43 1 0 14:06 ? 00:00:04 /usr/lib/jvm/java-7-oracle/bin/java -Djava.util.logging.config.file=/var/lib/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed -classpath /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/var/lib/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp org.apache.catalina.startup.Bootstrap start
#PID FILE HAS CORRECT PID
root@a2cf26ade2a9:/# cat /var/run/tomcat7.pid
43
#START-STOP-DAEMON --TEST REPORTS THAT IT WOULD START TOMCAT
root@a2cf26ade2a9:/# start-stop-daemon --test --start --pidfile /var/run/tomcat7.pid --user tomcat7 --exec /usr/lib/jvm/java-7-oracle/bin/java
Would start /usr/lib/jvm/java-7-oracle/bin/java .
root@a2cf26ade2a9:/# echo $?
0
这篇关于服务tomcat7启动失败,但进程存在,tomcat正在运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!