views:

17

answers:

2

I'm developing a JSP/Servlet webapp on Tomcat. How should I refresh some things (servlet classes, web.xml, JSPs etc.) while it is functioning?

I can use a boolean variable in my servlets to detect it will be a maintenance period so all the requests will be ignored. (All my servlets extend my own base servlet class, so the only thing I have to do is an "if" check in my base class and a getter/setter to the boolean) But this is not enough to refresh the files.

Do I have to switch off my app, replace the things and redeploy? I'd like to show a "Maintenance period, please wait..." page to my users while I'm refreshing the app.

How should I do that?

A: 

Depending on version, Tomcat supports "hot redeploy": Just redeploy the WAR file and it'll pick up the updates.

There are reports of memory issues when you do this. Perm gen space might get filled up if you repeat too many times.

duffymo
A: 

Having a "maintenance" page is only possible if you front Tomcat by another webserver. A commonly used approach is Apache HTTPD which is connected to Tomcat by mod_jk. When maintaining the webapplication on Tomcat, just let HTTPD display the maintenance page instead of forwarding the request to Tomcat.

BalusC