We're currently in a situation where a Tomcat service is being brought offline by a batch script each night (or at the presence of a war archive, at least) in a Windows clustered environment.

The problem is that when Windows shuts down the tomcat service, it does not do so gracefully. This could mean (and has multiple times) that a service is listening and being used during the shutdown, alas terminating abnormally - or as in our case, we want to deploy a new webapp with the same name, but a jar file is being locked due to being in use.

Does anyone know of a nice way to gracefully shutdown the Tomcat service in this kind of solution? We're running Tomcat 5.5.

link|improve this question

71% accept rate
I know what you mean. You have to issue the shutdown command on the JVM. I'm flagging the question for interest's sake. – Randolph West Oct 19 '09 at 12:59
feedback

1 Answer

up vote 1 down vote accepted

Have you looked at Windows service HOW-TO? From looking at that it seems possible to change what happens at service start and stop after it is installed.

link|improve this answer
If I understand the service how-to correctly, it would seem that we could call something like "Tomcat5 //SS//Tomcat5" from the batch script at shutdown, then "Tomcat5 //TS//Tomcat5" to start it up? It's worth a short at least. Thanks for the link, +1. – Mahriman Oct 19 '09 at 14:13
By the way, wouldn't this cause problems since cluster services will try to bring the service online again? In such case, would I have to both use tomcat5 and cluster resource /offline, or what? – Mahriman Oct 19 '09 at 14:15
MSCS isn't my strong point but I'd say yeah you would have to take the cluster resource offline as well. Have a look at how [cluster.exe][1] works. [1]: technet.microsoft.com/en-us/library/cc723245.aspx – Sim Oct 19 '09 at 20:43
It would seem that //SS// doesn't close Tomcat very well, this might however be due to our installation and not normal behavior. It would seem that what I was looking for is possible with the above answer, so I'm putting a resolve on this. – Mahriman Oct 20 '09 at 9:21
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.