启动tomcat是出现错误( Parse Fatal Error at line 1 column 1: Content is not allowed in prolog.)

2010-3-8 9:38:58 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2010-3-8 9:38:58 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 468 ms
2010-3-8 9:38:58 org.apache.commons.digester.Digester fatalError
严重: Parse Fatal Error at line 1 column 1: Content is not allowed in prolog.
org.xml.sax.SAXParseException: Content is not allowed in prolog.
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.commons.digester.Digester.parse(Digester.java:1567)
        at org.apache.catalina.users.MemoryUserDatabase.open(MemoryUserDatabase.java:370)
        at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:97)
        at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:129)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:791)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.jav
a:155)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.jav
a:125)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.j
ava:97)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:2306)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
2010-3-8 9:38:58 org.apache.naming.NamingContext lookup
警告: Unexpected exception resolving reference
org.xml.sax.SAXParseException: Content is not allowed in prolog.
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.commons.digester.Digester.parse(Digester.java:1567)
        at org.apache.catalina.users.MemoryUserDatabase.open(MemoryUserDatabase.java:370)
        at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:97)
        at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:129)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:791)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.jav
a:155)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.jav
a:125)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.j
ava:97)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:2306)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
2010-3-8 9:38:58 org.apache.catalina.mbeans.GlobalResourcesLifecycleListener createMBeans
严重: Exception processing Global JNDI Resources
javax.naming.NamingException: Content is not allowed in prolog.
        at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.jav
a:155)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.jav
a:125)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.j
ava:97)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:2306)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
2010-3-8 9:38:58 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2010-3-8 9:38:58 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/5.0.28
2010-3-8 9:38:58 org.apache.commons.digester.Digester fatalError
严重: Parse Fatal Error at line 1 column 1: Content is not allowed in prolog.
org.xml.sax.SAXParseException: Content is not allowed in prolog.
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.commons.digester.Digester.parse(Digester.java:1567)
        at org.apache.catalina.users.MemoryUserDatabase.open(MemoryUserDatabase.java:370)
        at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:97)
        at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:129)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:791)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
        at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:252)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
        at org.apache.catalina.core.StandardService.start(StandardService.java:480)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
2010-3-8 9:38:58 org.apache.naming.NamingContext lookup
警告: Unexpected exception resolving reference
org.xml.sax.SAXParseException: Content is not allowed in prolog.
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.commons.digester.Digester.parse(Digester.java:1567)
        at org.apache.catalina.users.MemoryUserDatabase.open(MemoryUserDatabase.java:370)
        at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:97)
        at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:129)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:791)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
        at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:252)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
        at org.apache.catalina.core.StandardService.start(StandardService.java:480)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
javax.naming.NamingException: Content is not allowed in prolog.
        at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
        at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:252)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
        at org.apache.catalina.core.StandardService.start(StandardService.java:480)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
2010-3-8 9:38:58 org.apache.catalina.startup.Catalina start
严重: Catalina.start:
LifecycleException:  No UserDatabase component found under key UserDatabase
        at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:259)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
        at org.apache.catalina.core.StandardService.start(StandardService.java:480)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
2010-3-8 9:38:58 org.apache.catalina.startup.Catalina start
信息: Server startup in 78 ms

 

问题解决过程及原因分析:

    以"No UserDatabase component found under key UserDatabase"为关键字搜索,看了几篇文章说的产生的情况各不相同,查看tomcat的server.xml文件没有异常,所以备份server.xml文件后,以server-minimal.xml文件作为server.xml文件启动也还是有错误,这时看到conf目录下还有个tomcat-users.xml文件,用emeditor打开时出现"Null character(00H) contained in the file  will be replaced with spaces."的message box,才知道是这个文件出了问题。

    找到之前安装的tomcat(版本相同)的备份目录,copy了一个tomcat-users.xml文件,再启动tomcat就正常了,把备份的server.xml文件改回来后,启动也正常了。

    看了那个损坏了的tomcat-users.xml文件的修改时间才发现这个文件就在刚刚之前被修改过了,而刚刚之前我重启了电脑,重启的时候等了半天win7还是在关机中,所以我就按就电源天关n秒强制关机了,估计就是因为这个,才造成的文件损坏。

—————————————————————————————————————————————————————————————————————————————

    原先百度一直说是web.xml文件有编码错误,浪费我好长时间也没弄好,终于看到这篇文章,算是救了我啊!!再次感谢啦

我用的是MyEcplise自带的tomcat,后来就找了tomcat6.x的/conf下的tomcat-users.xml复制到自带tomcat的/conf下,重启就好了

你可能感兴趣的:(启动tomcat是出现错误( Parse Fatal Error at line 1 column 1: Content is not allowed in prolog.))