views:

36

answers:

1

Is it possible to configure web.xml to reload a specific tomcat webapp at a particular time automatically. If not, is it possible to do this programatically?

+3  A: 

Programatically - an option is to write an Ant script for reload the webapp you want based on the example given on the Tomcat docs

So you'll be left with a command like

ant -Dpassword=secret reload

and put this into a cron tab on your server (if Unix/Linux) or Windows Task Scheduler for windows.

I notice you've tagged your question garbage-collection. If you are redeploying the web app due to excessive GC, then its better to tackle the root cause of the issue since this reload is only a workaround.

Run a profiler to identify memory leaks.

Related Reading on Memory Issues / GC

http://stackoverflow.com/questions/1638011/java-memory-leak

http://stackoverflow.com/questions/2847138/when-log-shows-a-lot-of-gc-hits-what-code-change-shall-we-need/2847281#2847281

http://stackoverflow.com/questions/3077154/ways-to-reduce-memory-churn/3077857#3077857

JoseK
Points for mentioning that the problem is to be solved somewhere else. Keeping reloading it makes no sense.
BalusC