Tomcat auto deploy before war copy is complete

deploymenttomcat

I have auto deploy enabled on my tomcat 7 server. I deploy the war to the tomcat webapps directory over SCP from my Jenkins server. The problem is that Tomcat sometimes tries to unpack the WAR while it is in the process of being copied.

Is this a known issue? And is there a workaround? Maybe I could copy the war to a different directory over SCP and then do a local file copy to the webapps directory, but I'd prefer to not have the extra step if I don't need to.

Best Answer

The manager webapp installs to a file with extension .tmp and then does a mv 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:

  • copy to a tmp location and mv
  • use the manager application/api