I'd like to know how to configure tomcat 6 in order to be able to replace a file from a war - for instance an image or a jsp - so I don't need to restart the server to keep it updated. I assume I'll have to deploy it as a directory - not just copying the war file to webapp ?
Thanks.
If you have access to the server you can explode the WAR to a separate directory (using
jar -xf application.war
) and then add the web-app to the Tomcat instanceTOMCAT_ROOT/conf/Catalina/localhost
directory.For example - if your application were called "my-app" you would create a file within
TOMCAT_ROOT/conf/Catalina/localhost/my-app.xml
which contained details of the application. For a very simple application this might just be something like:You might also have more complicated configuration (such as database connection parameters, etc.) within here.
If you then want to redeploy the application after you've changed an individual object (JSP, image, etc.) you can use the manager app to redeploy without having to restart the whole Tomcat environment.
You can deploy application by removing the *.war from the webpps directory.
Also you can do that, if you connect to tomcat jmx manager http://server/manager/html, so select the application that you need to remove and click on deploy.
Yes, deploy a directory. You can also push a new .war file and Tomcat will do the right thing without the need for restarting Tomcat.
IIRC, you can modify files of an exploded war file, and it will work. But it will cause problems (the war will be reexploded on restart, for instance, and overwrite).