PID file exists, but process is not running

2019-05-05 03:48发布

问题:

I'm working in centos6. I have installed tomcat6. At the first all works fine. But after restarting the server tomcat6 did not work properly.

When I execute this command line:"service tomcat6 status" I get: "PID file exists, but process is not running [ÉCHOUÉ]" I checked to the log file "catalina.out" and I get this error:

GRAVE: StandardServer.await: create[8005]:

java.net.BindException: Cannot assign requested address
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(Unknown Source)
        at java.net.ServerSocket.bind(Unknown Source)
        at java.net.ServerSocket.<init>(Unknown Source)
        at org.apache.catalina.core.StandardServer.await(StandardServer.java:373)
        at org.apache.catalina.startup.Catalina.await(Catalina.java:657)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:617)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Thanks in advance for your helps

回答1:

If Tomcat's startup scripts are run with CATALINA_PID environment variable set properly, then the PID of the Tomcat process will be recorded to a file upon startup. If the file exists when you try to start Tomcat, the scripts will refuse to run because it does not want to clobber a (possibly valid) PID file.

If you are sure that Tomcat is not running, simply delete the file (it should be available through the CATALINA_PID environment variable) and try again.

If you want a self-re-starting service, considering looking at jsvc, which actually ships with Tomcat binaries in source form.



回答2:

Which port you are running tomcat? port 80 or 8080? Any other services running on the same port? Did you check? You can kill tomcat using its process id

ps -ax | grep tomcat
kill -9 <PID>

if you are sure tomcat is the only java application you are running, then you can kill it using,

killall -9 java

watch the catelina.out using tail when you restart it.

something like this,depending on your installation method/path:

tail -f /usr/share/apache-tomcat-6.0.37/logs/catalina.out

Also check in you init scripts or setenv.sh where you configured this PID file. I never used it.