Hi All, I am currently using Tomcat 5.5.9 on Window XP Pro in my development environment and I believe I have finally tracked down the cause of a problem that has been plaguing me for some time. Until recently I've not had the time to do the testing to establish what the problem was. It appears to me that if you use a context.xml file inside a WAR file and include in that file a <Context ...></Context> element (ie an element with opening and closing tags, attributes, but no contents) Tomcat will not deploy the context properly.
In my development environment, I put each of my web apps in its own subdirectory of a directory called D:/webapps. For a new app, I create a directory in D:\webapps (eg D:\webapps\newapp) and create new host entry in server.xml with the Application Base pointing to this directory. I then build a WAR file, named ROOT.war, containing the web application and a context.xml file inside its /META-INF directory. I drop this into the appropriate ApplicationBase folder. What I found is that sometimes Tomcat would pick this up and deploy it happily and sometimes it just display a file listing (one file, the ROOT.war file). In the latter case, the only thing that turned up in the logs was something like this in the stderr log file: 17/10/2005 08:33:41 org.apache.catalina.startup.ContextConfig applicationWebConfig INFO: Missing application web.xml, using defaults only StandardEngine[Catalina].StandardHost[newapp].StandardContext[] Now the WAR file always contained a web.xml file in the WEB-INF directory and I spent a lot of time playing with it, thinking there may be something subtle wrong with it. The problem was, if I unpacked the WAR file and added a root context (via the Tomcat Admin interface) it all worked OK, suggesting to me there was nothing wrong with the web.xml file. I finally worked out that if you have a context.xml with the following contents: <?xml version="1.0" encoding="UTF-8"?> <Context reloadable="true" docbase="ROOT"> <!-- gratuitous comment --> </Context> or <?xml version="1.0" encoding="UTF-8"?> <Context reloadable="true" docbase="ROOT"> </Context> Tomcat will fail to deploy the web application and will display the "missing application web.xml" message in the stderr log file. however, if you change the context.xml file to the following: <?xml version="1.0" encoding="UTF-8"?> <Context reloadable="true" docbase="ROOT"/> Tomcat deploys the application successfully. I believe that the first two examples should work and that this constitutes a bug. However, before posting it on bugzilla, I thought I'd post it here to see what others thought. I also thought that by including the error message, anyone else searching on "missing application web.xml" would turn this message up and it might save them some time working out what the problem is. BTW, if anyone else wants to test this, I have some very simple WAR files I can post/email to demonstrate the problem. What does everyone else think? Rob Hills NetPaver Pty Ltd West Perth Western Australia --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]