Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's an easy, quick way to reload a webapp in tomcat in dev environment?

Tags:

java

tomcat

I'm running Tomcat 6 on Windows. I've got the "Monitor Tomcat" system tray icon which allows me to start and shutdown Tomcat, but is there another little tool that allows me to easily reload my web app when I've changed the class files? I know the "manager" app that comes with Tomcat has a redeploy option, but just wondering if there's a native app that would do this a bit quicker and nicer?

like image 396
Marplesoft Avatar asked Nov 25 '09 23:11

Marplesoft


2 Answers

Assuming you've already set reloadable=true, you can touch either the war file in the webapps directory, or a monitored file such as WEB-INF/web.xml in the exploded application directory. This will update the time stamp and make the app look new, so it will be reloaded.

At our company, we run our Web app servers in dev mode all the time just to facilitate this. To hell with the recommendation, we know better than to run our app on 99% load so we can't spare a few cycles.

like image 97
Carl Smotricz Avatar answered Oct 11 '22 16:10

Carl Smotricz


Just add a reloadable=true attribute to the Context. Quoting the documentation:

Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. That's why the default setting for this attribute is false. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.

like image 21
Pascal Thivent Avatar answered Oct 11 '22 18:10

Pascal Thivent