Bug 49195

Summary: Using -1 as shutdown port with Windows service works, but prints error message
Product: Tomcat 6 Reporter: Konstantin Kolinko <knst.kolinko>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: minor    
Priority: P2    
Version: 6.0.26   
Target Milestone: default   
Hardware: PC   
OS: Windows XP   

Description Konstantin Kolinko 2010-04-27 10:22:54 UTC
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.
Comment 1 Mark Thomas 2010-10-04 17:04:50 UTC
This has been fixed in 6.0.x and will be included in 6.0.30 onwards.