java resolves byte 2 of an exception 2-byte UTF-8 sequence Invalid problem _java

Source: Internet
Author: User

java resolves byte 2 of an exception 2-byte UTF-8 sequence Invalid problem

Recently done the project, encountered an exception 2 bytes of the UTF-8 sequence of bytes 2 invalid problem, the Internet to find the next data, here to record the solution, have encountered the same problem everyone, you can see

Verbose exception:

December 08, 2015 7:16:55 pm org.apache.catalina.core.StandardWrapperValve invoke severity: Servlet.service () for Servlet [JSP] in C Ontext with path [/test] threw exception [Org.apache.jasper.JasperException:XML parsing error on file org.apache.tomcat.u TIL.SCAN.MERGEDWEBXML] with root cause com.sun.org.apache.xerces.internal.impl.io.malformedbytesequenceexception:2
 Byte 2 of the UTF-8 sequence of bytes is invalid. 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)

Workaround:

There are file Catalina.bat in Tomcat's Bin directory

Find this line:set java_opts=%java_opts%%logging_config%

On the line above it add:set Java_opts=-server-dfile.encoding=utf-8

Thank you for reading, I hope to help you, thank you for your support for this site!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.