When using the manager webapp specifying to deploy a local directory with the war parameter and specifying a context.xml that specifies a war file with the docBase parameter, the manager fails with java.util.zip.ZipException. Here is an example deployment URL http://localhost:8080/manager/deploy?config=file://C:/Projects/tts/apps/tts-webapp/src/conf/tts-dev-local.xml&war=file://C:/Projects/tts/apps/tts-webapp/build/war Error Message: FAIL - Encountered exception java.io.IOException: java.util.zip.ZipException: The system cannot find the file specified where: the URL file://C:/Projects/tts/apps/tts-webapp/src/conf/tts-dev-local.xml points to a file containing this config (slightly abreviated): <Context displayName="My App Name" path="" docBase="tts.war" debug="99"> ... some stuff ... </Context> the URL file://C:/Projects/tts/apps/tts-webapp/build/war points to my directory where I construct a war-format layout with my webapp If I change the docBase in the context.xml to "tts.wart" it deploys: OK - Deployed application from context file file://C:/Projects/tts/apps/tts-webapp/src/conf/tts-dev-local.xml It appears that the determination of whether we are deploying from a war file or a directory is made when the context.xml is read and isn't overriden when the "war" parameter to the manager's "deploy" action is specified. Therefore, it's either still using the value from the context.xml (and looking for it under webapps) or it's trying to open the directory as a zip file or the directory plus + ".war" or something.
More info on this bug: The context.xml that you supply to the Manager is unaltered, it appears to be copied verbatim to $CATALINA_HOME/conf/<serviceName>/<hostName>/ (where context.xml files go). The next time that Tomcat starts, it reads these values and will thus deploy (or attempt to deploy) differently than when it was deployed with the Manager specifying the overriding parameters. I think that the solution is to re-write the context.xml file rather than adding code to handle the special case of the overridden war file. After it is re-written, it can then be parsed and processed as though there were no exceptions. This would solve several problems at once. If I understand the commons component correctly that creates these objects (which I only barely understand it) from the xml then we would only be running that after we re-wrote the xml. That would solve both problems, the ".war file vs. war layout directory" issue and the "next time you boot Tomcat it uses old war value" issue. Then the file could be written to conf/<service name>/<host name> correctly and it's much smoother. Now, how should we re-write it? We can parse it, change the values and then write it out or we can basically find and replace hack it. But I'm personally for a more sophisticated solution that is probably a bigger mouthful then anybody wants, but it's an idea.... I have long since been unsatisfied with the Admin webapps behavior of writing out my xml files with comments stripped and it's own (not too friendly) formatting. It would be really nice if there was a somewhat extended parsing functionality that records comments as metadata. If we wanted to go a bit further, we could also attempt to analyze the formatting to determine what formatting conventions is being used along with a probability factor of how certain they are using that convention (some people just sorta throw up in their code editor and call it art). Then, when we write it, we can write the comments back out and reusing their original formatting convention if it was consistent enough, or use a better formatting convention than we are currently at least. Daniel
Daniel, does this happen in 5.5.9? Chances of it getting fixed in 5.0 are slim...
This is handled cleanly (with a single warning on Tomcat restart) by the latest 5.5.x code. Given that there has been little development on the 5.0.x branch for some time and little chance of future development I am closing this as WONTFIX for 5.0.x