DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=37186>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=37186 Summary: blank line at start at start of tomcat-users.xml file leads to failure of UserDatabase Product: Tomcat 5 Version: 5.5.9 Platform: PC OS/Version: Windows XP Status: NEW Severity: normal Priority: P2 Component: Catalina AssignedTo: tomcat-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] I accidentally added a blank line to the start of my conf/tomcat-users.xml file (i.e., above the "<?xml" line). This caused a long stacktrace to logs\stdout[date].log on startup (see below), and failure of "standard" Realm authentication. This seems a very tiny error to cause a failure, and the error message did not help to find it. This error happened on an otherwise clean install of TC5.5.9/JDK1.5.0_02-b09 - the only change that I had made was to edit tomcat-users.xml to enable access to the manager webapp. The key parts of the stack trace were: 20-Oct-2005 19:16:20 org.apache.tomcat.util.digester.Digester fatalError SEVERE: Parse Fatal Error at line 2 column 6: The processing instruction target matching "[xX][mM][lL]" is not allowed. ... 20-Oct-2005 19:49:50 org.apache.naming.NamingContext lookup WARNING: Unexpected exception resolving reference ... 20-Oct-2005 19:49:51 org.apache.catalina.realm.UserDatabaseRealm start SEVERE: Exception looking up UserDatabase under key UserDatabase This baffled me initially. It was not initially clear that this was an XML validation error, or even which file was causing the error. In fact the last of the 3 errors above initially made me suspect a UserDatabase naming problem between server.xml and manager.xml. On a related point, the parser seems more tolerant of other similar errors. If a comment line is added above the "<?xml" line rather than a blank line, catalina removes the comment and carries on. If a blank line is added after the "<?xml" line, rather than before it, catalina removes the line from the file. Equally, catalina adds the "<?xml" line to the file if it is omitted. In all 3 cases, catalina overwrites the file with a "corrected" version. None of these errors cause exceptions or failure of the UserDatabase. So I have three points that I'd like to make please: 1. The error message would be much more helpful if it included the path/name of the XML file that is causing the problem :) 2. Is a blank line above the "<?xml" line actually invalid XML? Even if it is, it seems very harsh to reject this error when other similar ones are allowed/corrected. 3. Overwriting the config file is an annoyance for administrators, especially when it removes comments. I would suggest that it might be better to just report an exception and have the adminstrator look at it the config file and fix it. Contents of tomcat-users.xml and stack trace follow. Thanks. ============================================================ tomcat-users.xml as follows: ------------------------------------------------------------ <?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="manager"/> <user username="manager" password="manager" roles="manager"/> </tomcat-users> ============================================================ ============================================================ Trimmed stack trace from stdout log follows: ------------------------------------------------------------ 20-Oct-2005 19:49:50 org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 20-Oct-2005 19:49:50 org.apache.catalina.startup.Catalina load INFO: Initialization processed in 3875 ms 20-Oct-2005 19:49:50 org.apache.tomcat.util.digester.Digester fatalError SEVERE: Parse Fatal Error at line 2 column 6: The processing instruction target matching "[xX][mM][lL]" is not allowed. org.xml.sax.SAXParseException: The processing instruction target matching "[xX] [mM][lL]" is not allowed. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseExcep tion(ErrorHandlerWrapper.java:236) 20-Oct-2005 19:49:50 org.apache.naming.NamingContext lookup WARNING: Unexpected exception resolving reference org.xml.sax.SAXParseException: The processing instruction target matching "[xX] [mM][lL]" is not allowed. at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (AbstractSAXParser.java:1269) 20-Oct-2005 19:49:50 org.apache.catalina.mbeans.GlobalResourcesLifecycleListener createMBeans SEVERE: Exception processing Global JNDI Resources javax.naming.NamingException: The processing instruction target matching "[xX] [mM][lL]" is not allowed. at org.apache.naming.NamingContext.lookup(NamingContext.java:804) 20-Oct-2005 19:49:50 org.apache.catalina.core.StandardService start INFO: Starting service Catalina 20-Oct-2005 19:49:50 org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/5.5.9 20-Oct-2005 19:49:50 org.apache.tomcat.util.digester.Digester fatalError SEVERE: Parse Fatal Error at line 2 column 6: The processing instruction target matching "[xX][mM][lL]" is not allowed. org.xml.sax.SAXParseException: The processing instruction target matching "[xX] [mM][lL]" is not allowed. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseExcep tion(ErrorHandlerWrapper.java:236) 20-Oct-2005 19:49:50 org.apache.naming.NamingContext lookup WARNING: Unexpected exception resolving reference org.xml.sax.SAXParseException: The processing instruction target matching "[xX] [mM][lL]" is not allowed. at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (AbstractSAXParser.java:1269) 20-Oct-2005 19:49:51 org.apache.catalina.realm.UserDatabaseRealm start SEVERE: Exception looking up UserDatabase under key UserDatabase javax.naming.NamingException: The processing instruction target matching "[xX] [mM][lL]" is not allowed. at org.apache.naming.NamingContext.lookup(NamingContext.java:804) 20-Oct-2005 19:49:51 org.apache.catalina.startup.Catalina start SEVERE: Catalina.start: LifecycleException: No UserDatabase component found under key UserDatabase at org.apache.catalina.realm.UserDatabaseRealm.start (UserDatabaseRealm.java:230) 20-Oct-2005 19:49:51 org.apache.catalina.startup.Catalina start INFO: Server startup in 859 ms ============================================================ -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]