Project: Tomcat
Bug 49195 Using -1 as shutdown port with Windows service works, but prints error message
Reported: 2010-04-27 10:22:54 | Status: resolved fixed

1. Install Tomcat as a service on Windows 2. Specify <Server port="-1" in server.xml 3. Start the service, and then stop the service. 4. The following is printed in the catalina.2010-04-27.log: 27.04.2010 17:49:13 org.apache.catalina.startup.Catalina stopServer SEVERE: No shutdown port configured. Shut down server through OS signal. Server not shut down. It is just a message. Tomcat stops regardless of it: After printing the message Catalina#stopServer() performs System.exit(1) which results in Tomcat shutdown. I think that when service launcher stops Tomcat, Catalina#server is not null. That can be used to differentiate the two use cases. There could be improvements on how to stop Tomcat. E.g., to call Catalina.stop(). If that is the case, it would be better to use wait(10000) instead of sleep(10000) in StandardServer.await(), so that it could be woken by a notifyAll() call, or use interrupt() call to wake it up (if we know the thread). System.exit(0) would work regardless of all that. I suppose that jsvc may show the same behaviour, but I have not tried.

Files changed in fix:
java/org/apache/catalina/startup/Catalina.java