在Myeclipse7.0中调试程序,debug server的时候出现如下警告提示,并且tomcat6.0无论如何都不能启动:
警告: Catalina.start using conf/server.xml: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 2-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.scanData(Unknown Source)at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanComment(Unknown Source)at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanComment(Unknown Source)at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(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 com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1562)at org.apache.catalina.startup.Catalina.load(Catalina.java:490)at org.apache.catalina.startup.Catalina.load(Catalina.java:524)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.load(Bootstrap.java:260)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)2010-7-28 23:45:40 org.apache.catalina.startup.Catalina load警告: Catalina.start using conf/server.xml: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 2-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.scanData(Unknown Source)at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanComment(Unknown Source)at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanComment(Unknown Source)at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(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 com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1562)at org.apache.catalina.startup.Catalina.load(Catalina.java:490)at org.apache.catalina.startup.Catalina.start(Catalina.java:544)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:288)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
经过艰难的排错,最后发现都是修改tomcat6.0的“server.xml”惹的祸,由于为了避免tomcat的8080端口号与oracle发生冲突,本人在tomcat6.0的“server.xml”中将端口号设置为了8888,但是错就错在不该添加中文注释,由于“server.xml”是UTF-8编码的,文件内添加了中文字符导致tomcat出现错误:
解决方法也很明了,删除server.xml文件中的汉字即可。
有时候即使server.xml文件中没有汉字也会出现错误,原因有可能是server.xml文件的编码与Myeclipse的设置不符。