Invalid byte 2 of 2-byte UTF-8 sequence解决方案

异常信息如下:

2009-9-14 3:56:54 org.apache.catalina.startup.Catalina stopServer   
严重: Catalina.stop:    
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.scanLiteral(Unknown Source)   
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(Unknown Source)   
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanAttribute(Unknown Source)   
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(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:1644)   
    at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:410)   
    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.stopServer(Bootstrap.java:337)   
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415) 

 

 

 

解决方案如下:

 

方案1

检查tomcat里面的配置文件中有没有使用汉字(包括注释),有汉字则把汉字改成英文

 

方案2

在有汉字的配置文件中,加入如下代码

<?xml version="1.0" encoding="gbk"?>

posted @ 2012-03-07 13:48  balaamwe  阅读(10263)  评论(0编辑  收藏  举报