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.
It could be a number of things. Some specific issues I've hit:
(1) File permissions. Make sure the webapps directory, your work directory, the war itself, and any special files it accesses are all readable/writeable by the user running Tomcat (ideally they should be owned by that user).
(2) The previous version isn't fully removed. Try stopping Tomcat, deleting the war and matching folder, copying the new war in, then starting Tomcat. If it works then, the problem might be left over files. (I have an app for example that doesn't completely clean itself up).
(3) The app might not be initializing properly due to issues with the app. If the war deploys automatically into a folder, autodeploy is working, but the app didn't fully initialize. Look for log messages. Depending on your app, this might be in tomcat/logs, the current directory, or standard out. If you can, change the log properties (e.g. log4j.properties file) to show debug level messages.
(4) Permgen mememory problems. When you reload an app in Tomcat, it uses up Permgen memory. By definition, this can't be recovered. Reload too much, and Tomcat will crash with an out-of-memory error (you can usually see this in your logs). Either configure more permgen, or better yet, shut off/restart Tomcat when redeploying an app.
http://wiki.apache.org/tomcat/OutOfMemory
Best Answer
The manager webapp installs to a file with extension
.tmp
and then does amv
to actually install it, so I agree with @peterh that this is recommended.Note that if you are downloading it directly while Tomcat will attempt to unpack an incomplete download and show errors in the log, it will normally reattempt unpack-and-install once it completes, so the errors are usually benign. However there is a bug whereby sometimes it will not proceed to install after a failed unpacking. This is bug 57765, and the suggested solution will prevent also the benign error messages. However until this is resolved you should use one of the suggestions already made:
mv