tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Van der Goot" <erik.van-der-g...@jrc.it>
Subject Tomcat as an NT Service
Date Wed, 06 Aug 2003 14:18:23 GMT
We have just made a small mod to the javaservice.exe program (see 
also  http://www.alexandriasc.com) , known to most of you as tomcat.exe 
from the tomcat bin directory.

If you are interested, please get in touch with  erik.van-der-goot@jrc.it 
or ken.blackler@jrc.it.

The reason for the change is that we wanted to use the Win2000 Server 
service recovery feature in some cases in order to keep the system alive 
even when there is a problem. One case in point is a java.lang.OutOfMemory 
error which is definitely and demonstrably dodgy, probably due to a garbage 
collecting problem. (Honest).

In the original software a System.exit(i) would indeed cause the service to 
terminate, but always gracefully, i.e. the service was always reported as 
STOPPED to the Service Control Manager.  Since this is not a failure, the 
service recovery does not come into action.

In order to be able to force the service recovery we modified the code to 
take different actions on different JVM exit codes.

A code of 0 is as per usual. No extra error messages, service stops.
An exit code > 0 a service specific error message is logged in the 
application log, but the service stops normally.
An exit code < 0 is considered as a serious fail and will register a 
service specific message, and FAIL the service. This means that the Service 
Recovery will come into action.

A minute later your system can be up and running again.

Note that there is a registry key which determines the system behaviour 
after service failure:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug
Auto = 0
Prompt user with debug window BEFORE terminating the process (and therefore 
before allowing the service to restart). REQUIRES USER INPUT!!!!:

Auto = 1 (server default)
Don't prompt user with debug window, create dump file and then end the 
process, therefore allowing the service to restart"

Erik



Mime
View raw message