If: 1)you have a context, and the META-INF directory is not writable by the user tomcat runs as 2)you use the Admin application to change the server configuration 3)you use the commit changes button The save will abort, leaving a malformed server.xml and the user will be told that "changes were saved successfully" (or something similar). In essence, the write aborts on the host, and closing tags for engines, services, as well as other hosts are not written. I think the user needs to be informed that the save failed. In the best case, write of the server.xml should be atomic so that a malformed server.xml is not written. Here is the error log from when it happens: 2005-12-01 14:00:36,843 INFO http-8080-Processor14 org.apache.catalina.storeconfig.StandardContextSF - Store Context separate with backup (at file /home/chd/ROOT/META-INF/context.xml.2005-12-01.14-00-36 ) 2005-12-01 14:00:36,844 ERROR http-8080-Processor14 org.apache.catalina.storeconfig.StoreConfig - java.io.FileNotFoundException: /home/chd/ROOT/META-INF/context.xml.new (Permission denied) 2005-12-01 14:00:36,844 INFO http-8080-Processor14 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin] - action: Debugging -- changes saved to conf/server.xml 2005-12-01 14:03:26,667 INFO http-8080-Processor6 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin] - action: Entered TreeControlTestAction:perform() 2005-12-01 14:03:26,667 INFO http-8080-Processor6 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin] - action: tree param is null 2005-12-01 14:03:26,667 INFO http-8080-Processor6 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin] - action: Select event on Catalina:type=Host,host=calendar.chc1.org 2005-12-01 14:03:39,512 INFO http-8080-Processor14 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin] - action: Entered TreeControlTestAction:perform() 2005-12-01 14:03:39,512 INFO http-8080-Processor14 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin] - action: tree param is null 2005-12-01 14:03:39,512 INFO http-8080-Processor14 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin] - action: Select event on Catalina:type=Service,serviceName=Catalina 2005-12-01 14:06:02,231 INFO http-8080-Processor9
Good point, George. I've added a patch in time for 5.5.17 that checks the destination context config file is not null, indeed a file (as opposed to a directory), and writeable by Tomcat. If these checks pass, all is well, otherwise a diagnostic message is written to the log and an exception thrown before any file saving is done, so no corrupt server.xml will be written.
I have checkin a better version, for 5.5.17 But a bug with referenced war files outsite Host appBase exists. Currently context docBase from those apps point to extract webapps/app directory. StoreConfig can't detect the orginal war file and redeployment crashed!
George, does the limited fix included in 5.5.17 help you at all?
I actually deploy as an unpacked file so the WAR limitation doesn't affect me. Truthfully, since I'm also using the Manager application to auto deploy new hosts, I ended up writing my own server.xml file as part of my startup script. It just seemed a lot easier to generate the server.xml as part of the startup script rather than re-working the admin application to save the XML file. Right now I'm running something like 280 virtual hosts on one Tomcat instance. The Admin application just doesn't scale that big so I've pretty much abandoned it.
I have fix the StoreConfig external war file bug! You can use the StoreConfig via ANT JMX operations without Admin app.