程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> JAVA編程 >> 關於JAVA >> java 處理異常 2 字節的 UTF-8 序列的字節2 有效的問題

java 處理異常 2 字節的 UTF-8 序列的字節2 有效的問題

編輯:關於JAVA

java 處理異常 2 字節的 UTF-8 序列的字節2 有效的問題。本站提示廣大學習愛好者:(java 處理異常 2 字節的 UTF-8 序列的字節2 有效的問題)文章只能為提供參考,不一定能成為您想要的結果。以下是java 處理異常 2 字節的 UTF-8 序列的字節2 有效的問題正文


java 處理異常 2 字節的 UTF-8 序列的字節 2 有效的問題

    最近做項目,遇到異常 2 字節的 UTF-8 序列的字節 2 有效的問題,上網找了下材料,這裡記載下處理辦法,有遇到異樣問題的大家,可以看下

詳細異常:

十二月 08, 2015 7:16:55 下午 org.apache.catalina.core.StandardWrapperValve invoke
嚴重: Servlet.service() for servlet [jsp] in context with path [/test] threw exception [org.apache.jasper.JasperException: XML parsing error on file org.apache.tomcat.util.scan.MergedWebXml] with root cause
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字節的 UTF-8 序列的字節 2 有效。
 at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:687)
 at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:372)
 at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1753)
 at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.peekChar(XMLEntityScanner.java:497)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2710)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
 at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
 at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
 at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
 at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347)
 at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:96)
 at org.apache.jasper.compiler.JspConfig.processWebDotXml(JspConfig.java:83)
 at org.apache.jasper.compiler.JspConfig.init(JspConfig.java:231)
 at org.apache.jasper.compiler.JspConfig.findJspProperty(JspConfig.java:290)
 at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:113)
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:365)
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:345)
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
 at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:342)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 at org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter.doFilter(StrutsExecuteFilter.java:90)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.doFilter(StrutsPrepareFilter.java:91)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 at com.huaqin.dmt.filter.Acl.doFilter(Acl.java:251)
 at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
 at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 at com.huaqin.dmt.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:38)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
 at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:550)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:744)

處理辦法:

在tomcat的bin目錄下有文件catalina.bat

找到這行:set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%

在它上一行參加:set JAVA_OPTS=-server -Dfile.encoding=utf-8

感激閱讀,希望能協助到大家,謝謝大家對本站的支持!

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved