Force Tomcat 6 to Stop on Windows

continuous-deployment, tomcat6, war

Solution

If you don't run it as a service and Tomcat is the only Java application running then you can use taskkill. Something like `taskkill /F /IM java.exe` should do the trick.

Note the forcibly killing a Tomcat process is safe as far as Tomcat is concerned. Any applications running may not be so forgiving but since it is your app you'll know what is safe and what isn't.

Problem

We're using tomcat 6 to serve an activeMQ based Java backend for our application. Recently I've been looking into how to implement a Continuous Deployment solution for the server side components of this product. What I want to do is have our Continuous Ingegration server: 1. Throw the MSI installer onto a virtual machine 2. Stop Tomcat 3. Run the installer 4. Start Tomcat 5. Test that the server is running I can do all of this except for the shutdown Tomcat step. The problem That I'm facing is that Tomcat is not always graceful in it's shutting down. So I need to be able to force the server to shutdown. I am open as to weather or not to run Tomcat as a service. Does anyone have any information on how to shutdown Tomcat 6 on Windows? I have seen some documentation on using the `-force` parameter, but this has been patchy and aimed at Unix systems. Any information that you can provide would be greatly appreciated. Edit: Tomcat may not be the only Java process running on the machine.

Original source