Web tier: servlets, JSP, Web frameworks: war files and webapp deployment
- Posted by: Justin Kennedy
- Posted on: February 14 2006 07:23 EST
I have some basic questions about war files. Let's assume there's an existing webapp, called "foo", and the war file is called foo.war:
- When I put foo.war into the webapps, and restart tomcat, what happens to the existing contents of webapps/foo/ ?
- Is it possible to have partial files within foo.war, if I wanted to, for example, only deploy a patch?
- When deploying a war file, do I have to remove the existing directory under webapps, or will it just overwrite the existing files with what's in the war? (related to #1)
- Can you point me to any good web references that talks more about war files, and web app deployments?
If you're using Tomcat, you have to create a new and complete foo.war file, delete the previous foo directory, and restart Tomcat for your changes to take effect:
Copy the web application archive file into directory $CATALINA_HOME/webapps/. When Tomcat is started, it will automatically expand the web application archive file into its unpacked form, and execute the application that way. NOTE - If you use this approach, and wish to update your application later, you must both replace the web application archive file AND delete the expanded directory that Tomcat created, and then restart Tomcat, in order to reflect your changes.
There are probably other deployment options that allow you to deploy only patches (and not have to restart Tomcat). You'll have to try them out and see what happens.