Replace single file on tomcat-deployed war

10,287

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:

<Context docBase="/path/to/exploded/application/directory"/>

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:
10,287

Related videos on Youtube

xain
Author by

xain

Updated on September 17, 2022

Comments

  • xain
    xain over 1 year

    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.

  • xain
    xain about 14 years
    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.