解决tomcat启动时日志出现 javax.naming.NamingException: Invalid byte 1 of 1-byte UTF-8 sequence.的问题

时间:2022-10-31 21:10:54

重启tomcat时,启动成功,但打开8080页面时很慢,到最后还是打不开。查看tomcat日志如下:

2013-4-19 21:19:34 org.apache.coyote.http11.Http11AprProtocol pause
信息: Pausing Coyote HTTP/1.1 on http-8080
2013-4-19 21:19:34 org.apache.coyote.ajp.AjpAprProtocol pause
信息: Pausing Coyote AJP/1.3 on ajp-8009
2013-4-19 21:19:35 org.apache.catalina.core.StandardService stop
信息: Stopping service Catalina
2013-4-19 21:19:35 org.apache.catalina.startup.Catalina stop
严重: Catalina.stop
LifecycleException:  Pipeline has not been started
 at org.apache.catalina.core.StandardPipeline.stop(StandardPipeline.java:257)
 at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1060)
 at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:448)
 at org.apache.catalina.core.StandardService.stop(StandardService.java:510)
 at org.apache.catalina.core.StandardServer.stop(StandardServer.java:734)
 at org.apache.catalina.startup.Catalina.stop(Catalina.java:602)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:577)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2013-4-19 21:19:37 org.apache.coyote.http11.Http11AprProtocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2013-4-19 21:19:37 org.apache.coyote.ajp.AjpAprProtocol init
信息: Initializing Coyote AJP/1.3 on ajp-8009
2013-4-19 21:19:37 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 578 ms
2013-4-19 21:19:37 org.apache.naming.NamingContext lookup
警告: Unexpected exception resolving reference
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
 at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipString(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
 at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1581)
 at org.apache.catalina.users.MemoryUserDatabase.open(MemoryUserDatabase.java:402)
 at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:103)
 at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:140)
 at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
 at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:113)
 at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:137)
 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:109)
 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:81)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:693)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2013-4-19 21:19:37 org.apache.catalina.mbeans.GlobalResourcesLifecycleListener createMBeans
严重: Exception processing Global JNDI Resources
javax.naming.NamingException: Invalid byte 1 of 1-byte UTF-8 sequence.
 at org.apache.naming.NamingContext.lookup(NamingContext.java:805)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
 at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:113)
 at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:137)
 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:109)
 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:81)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:693)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2013-4-19 21:19:37 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2013-4-19 21:19:37 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/5.5.23
2013-4-19 21:19:37 org.apache.naming.NamingContext lookup
警告: Unexpected exception resolving reference
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
 at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipString(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
 at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1581)
 at org.apache.catalina.users.MemoryUserDatabase.open(MemoryUserDatabase.java:402)
 at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:103)
 at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:140)
 at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
 at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:253)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1006)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:448)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2013-4-19 21:19:37 org.apache.catalina.realm.UserDatabaseRealm start
严重: Exception looking up UserDatabase under key UserDatabase
javax.naming.NamingException: Invalid byte 1 of 1-byte UTF-8 sequence.
 at org.apache.naming.NamingContext.lookup(NamingContext.java:805)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
 at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:253)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1006)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:448)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2013-4-19 21:19:37 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:261)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1006)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:448)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2013-4-19 21:19:37 org.apache.catalina.startup.Catalina start
信息: Server startup in 94 ms

 

 

后来发现tomcat-users.xml的文件格式被转为别的格式了,用记事本打开都是一些乱码,当时想到这个文件应该是可以看到文本内容的,因此用正常格式的文件后,重启tomcat,问题解决了。