views:

53

answers:

1

What's the best approach to use in order to programmatically restart a Spring web app running on Tomcat?

I have two specific scneario's I'm considering:

Installation The user is configuring the system, providing database connection params etc. Once provided, the Spring data contexts are invalid, and I'd like to restart to re-initialize with the correct params.

Updgrading The application has downloaded an update, and needs to self-install. This may involve deploying an updated WAR, and running database upgrades. At this point, it seems like a restart of the app inside tomcat is the best way to go.

What approaches should I be using? I'd like to do this programmatically, so the user doesn't have to log in to the server itself.

+1  A: 

Tomcat manager application is created for such kind of stuff:
http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html

I did use it through ant, as part of my build script, and very fond of it.

Nikita Rybak