7
votes

Tomcat starts and runs just fine but never binds to the 8005 shutdown port. Consequently, I can only end it by killing it.

I am starting Tomcat with:

catalina.sh start

or:

startup.sh

The results are identical.

Server.xml snippet:

<Server port="8005" shutdown="SHUTDOWN">

Catalina.out snippet:

Aug 20, 2013 4:55:18 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Aug 20, 2013 4:55:19 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Aug 20, 2013 4:55:19 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2209 ms
Aug 20, 2013 4:55:19 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Aug 20, 2013 4:55:19 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.42

$ netstat -ln snippet:

tcp        0      0 :::8443                 :::*                    LISTEN
tcp        0      0 :::8009                 :::*                    LISTEN
tcp        0      0 :::8080                 :::*                    LISTEN

Note: Apache is bound to 8443 and 8080, it connects to tomcat via 8009

$ netstat -ln | grep 8005:
<nothing>

Should some indication of binding or failing to bind to port 8005 appear in catalina.out?

Is there some kind of syntax error I may have introduced in server.xml which would allow it to bind to the 8009 connector but not 8005?

I'm at a loss here because no errors are thrown, any suggestion would be helpful.

EDIT: In response to the link router provided I added the above "I am starting Tomcat with" and also tried:

startup.sh &

Still no binding to port 8005, results appeared to be identical in all cases.

2
8009 is the default AJP port.DwB
Have you tried running the shutdown script to shutdown tomcat?DwB
Yes the catalina.sh and shutdown.sh both attempt to connect to port 8005 in order to shutdown tomcat. They both fail due to "connection refused" because tomcat did not bind for listening on port 8005.user2700751
Old thread which has some suggestions, though unfortunately it's not clear if any of them worked: stackoverflow.com/questions/2217382/…rutter
Thank you for the link rutter. Unfortunately it looks like both suggestions work when the tomcat startup scripts are not used. The mailing list responder recommends using the startup scripts and the stackoverflow replier indicates his problem was with init(). I assume that means an init script like sysVinit which I have but am not using to replicate these results.user2700751

2 Answers

15
votes

Most likely your Tomcat instance has not fully started for some reason, and never got to the point that it started the shutdown listener. Did you post your entire start log? Normally, the very last message is something like "Server startup in XXX ms". I have noticed that the shutdown listener is only started at the very end.

The most common reason is something hanging or delaying in one of your web application initializations.

4
votes

Solution provided by DwB in comments:

  1. Tomcat does not bind to its shutdown port (8005) so that is not actually an indicator of a problem
  2. The problem was with one of our web apps, it was preventing tomcat from getting to setup the shutdown port. Trimming webapps out of server.xml allowed us to shutdown tomcat.