Hi!
I'm having problems with the "Missing application web.xml" error on dev
machines running Windows XP,. Tomcat 5.5.7, Java 5.0.
It happens when I try to deploy a war file by using the Manager app or by
placing it in the /webapps directory. Here are some of the things I've
done, each time trying to deploy the resulting WAR file with no success and
the same error:
1) Completely emptied the /webapps directory (per Paul's success below).
2) Verified existence of web.xml inside WAR file.
3) Uninstalled ROOT app and verified file removal from /webapps directory.
4) Checked order of elements in web.xml to fit spec.
5) Validated web.xml in Intellij Idea against
http://java.sun.com/dtd/web-app_2_3.dtd
6) Changed <web-app> tag from the sample web.xml in documentation to the one
used in Manager app from 5.5.7 build:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
7) Removed all comments and spaces from web.xml.
When I unpack the WAR manually and place the unpacked files in /webapps the
application works fine. Tomcat likes the web.xml, but it can't seem to find
it inside of the WAR file.
Incidentally, when I watch my /webapps directory during a Manager deploy,
the ROOT.war file does appear for a few seconds. It appears that Tomcat is
trying to find a web.xml inside of it, fails and then deletes the file.
I use Ant to build the WAR file:
<jar jarfile="ROOT.war">
<fileset dir="${files}" excludes="**/*.java"/>
</jar>
Any help appreciated. Seen this on two development XP machines today.
Best,
Joe Reger
---Original Message----------------------------------------------------
I just wanted to follow up and get into the record what I think is the
solution to the problem I asked about
on 1/20. I turns out that the reason I was getting "Missing
application web.xml" errors in my stdout.log
was because of a problem that arose during the undeployment
precipitated by my deployment of a new
build. It appears (just based on Tomcat's behavior) that when you move
a WAR file into the webapps directory, the first thing Tomcat tries to
do is delete the old unpacked version. In my case, it failed to do
that because (as I found) the servlet had open file handles to files
inside the servlet's context directory. Windows XP doesn't let you
delete files that it thinks are "in use", and I suspect that is the
trouble Tomcat was running into. Anyway, it deleted everything except
those files, including the web.xml file, which it then reported as
missing.
When I modified my code to make sure the files were closed after being
read, the problem went away. Well, I haven't had the fix in place long
enough to be sure it has gone away, but at the very least it certainly
seems to have helped a great deal, so I think the problem is solved.
--Paul Lynch (eph1v3t8 @ mailblocks.com)