3

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.

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
Jeff Storey
  • 448
  • 1
  • 7
  • 19
  • 1
    You could do this not by copy, but by a move. First you SCP into a temp directory, and then move ("mv" command from commandline) into the webapps directory. It is atomic. Copy weren't (similar problem could also happen while the file is only partially copied - only with a much smaller probability). In case of "mv" it were impossible. – peterh Jan 13 '15 at 08:24
  • Thanks. That was my initial thought as well. I'll give that a shot. – Jeff Storey Jan 13 '15 at 14:02
  • Maybe there is a more direct support for that, this is why I wrote a comment and not an answer. Normally I autodeploy with the tomcat manager application (uploading the file into /manager/text?...), imho it is much better automatizable as an scp and doesn't have this atomicity problem. – peterh Jan 13 '15 at 14:07
  • Agreed that would be an easier way to do it, but in our current setup that's not really possible. I won't bore you with the details here, but I'll still investigate if we can make that an option. – Jeff Storey Jan 13 '15 at 15:05

1 Answers1

3

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
Partly Cloudy
  • 276
  • 1
  • 2
  • 7