Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

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 instance TOMCAT_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.

share|improve this answer
    
This is exactly what I was looking for.. Thanks! –  xain Apr 28 '10 at 22:21

You can deploy application by removing the *.war from the webpps directory.


$ rm -fr /var/lib/tomcat5/webapps/myapp.war

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.

share|improve this answer
    
Thanks for your answer, but that's exactly what I don't want to do. I want to even edit a jsp file, change let's say an image reference, and I want tomcat to acknowledge the modification accordingly. –  xain Mar 9 '10 at 13:28

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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.