Exactly similar to bug 34654, I have an identical ZipException when using the tag attribute while deploying remotely using the ant <deploy> task. In bug 34654, comment 2, Yoav had mentioned something to the effect that he couldn't reproduce it and neither could the OP. I don't think the OP in bug 34654 ever mentioned that he couldn't reproduce it. I don't know why the OP never disputed that assumption. I can easily reproduce it by having a <deploy> ant task with a tag attribute such as: <deploy url="http://${host}:8080/manager" username="${tomcat.username}" password="${tomcat.password}" path="/${app.name}" update="true" tag="${tag.war}" war="file:${gen.dir}/war/${webapp.war}"/> If I take out the tag attribute, the remote deploy works fine. This is with tomcat 5.5.9, sun-jdk-1.5.0.03 on a Gentoo Linux machine. What the OP of bug 34654 was referring to in bug 34654, comment 1 was the fact that if you look inside the remote hosts' work/Catalina/localhost/manager directory, you will find a fully intact war file with the properly named directory (as per the tag). And indeed, the war file in that directory is complete and does not have any defects and/or corruptions.
(In reply to comment #0) > > If I take out the tag attribute, the remote deploy works fine. > > This is with tomcat 5.5.9, sun-jdk-1.5.0.03 on a Gentoo Linux machine. > To add some points of reference, this used to work fine in 5.0.28. In addition, I upgraded to 5.5.12 and it is broken in there as well.
My colleague and I have tracked down the problem. The bug was introduced in revision 1.22 in jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/ManagerServlet.java Starting from line 627 (in the 5.5.9 sources): // Copy WAR and XML to the host app base if needed if (tag != null) { deployedPath = deployed; File localWarCopy = new File(deployedPath, basename + ". war"); copy(localWar, localWarCopy); ----------------------> localWar = localWarCopy; ----------------------> copy(localWar, new File(getAppBase(), basename + ".war") ); } Taking out the above 2 marked lines fixes the problem.
Created attachment 16565 [details] Fix for tomcat 5.5.9 remote deploy while using tag via ant task
See ongoing discussion on dev@tomcat.apache.org mailing list titled "yet another tomcat goes stable and I still have to make a custom package" at Nabble: http://www.nabble.com/yet-another-tomcat-goes-stable-and-I-still-have-to-make-a-custom-package-t1318004.html
Created attachment 17943 [details] Fix for tomcat 5.5.16 for remote deploy while using tag via ant task
Created attachment 17944 [details] Fix for tomcat 5.5.16 for remote deploy while using tag via ant task
Fixed and patched, will be available in 5.5.17 The copy method makes a check make sure it doesn't overwrite file A with file B, if file A==file B