Byte 3 of the UTF-8 sequence of the Malformedbytesequenceexception:3 byte is invalid.

Source: Internet
Author: User

The error is as follows:

caused by:org.springframework.beans.factory.BeanCreationException:Error creating bean with Name ' sqltemplate ' defined In URL [File:/e:/sources/gitosc/wms-mine/wms-inventory/wms-inventory-web/target/classes/spring-config-dao.xml]: Cannot resolve reference to beans ' sessionfactory ' while setting constructor argument; Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' Sessionfactory ' defined in URL [file:/e:/sources/gitosc/wms-mine/wms-inventory/wms-inventory-web/target/classes/ Spring-config-dao.xml]: Invocation of Init method failed; Nested exception is org.springframework.core.NestedIOException:Failed to parse config resource:class path resource [SQLM Ap-config.xml]; Nested exception is Org.apache.ibatis.builder.BuilderException:Error parsing SQL Mapper Configuration.  Cause:org.apache.ibatis.builder.BuilderException:Error creating document instance. Cause:com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceExcepByte 3 of the UTF-8 sequence of the Tion:3 byte is invalid. At Org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference ( beandefinitionvalueresolver.java:334) at Org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary ( beandefinitionvalueresolver.java:108) at Org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments ( constructorresolver.java:637) at Org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor (constructorresolver.java:145 ) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor ( abstractautowirecapablebeanfactory.java:1075) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance ( abstractautowirecapablebeanfactory.java:979) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( abstractautowirecapablebeanfactory.java:487)  
    At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:458) at org.springframework.beans.factory.support.abstractbeanfactory$1. GetObject (abstractbeanfactory.java:296) at Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:223) at Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:293) at Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:198) at Org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource ( commonannotationbeanpostprocessor.java:445) at Org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource ( commonannotationbeanpostprocessor.java:419) at Org.springframework.context.annotation.commonannotationbeanpostprocessor$resourceelement.getresourcetoInject (commonannotationbeanpostprocessor.java:547) at Org.springframework.beans.factory.annotation.injectionmetadata$injectedelement.inject (InjectionMetadata.java : 155) at Org.springframework.beans.factory.annotation.InjectionMetadata.inject (injectionmetadata.java:87) at O Rg.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues ( commonannotationbeanpostprocessor.java:304) ...  
    The byte 3 of the UTF-8 sequence of the caused By:com.sun.org.apache.xerces.internal.impl.io.malformedbytesequenceexception:3 byte 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:435) at Com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load (xmlentityscanner.java:1753) at Com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanData (xmlentityscanner.java:1252) at Com.sun.org.apache.xerces.internal.impl.XMLscanner.scancomment (xmlscanner.java:778) at Com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanComment ( xmldocumentfragmentscannerimpl.java:1046) at Com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl$fragmentcontentdriver.next ( xmldocumentfragmentscannerimpl.java:2980) at Com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next (xmldocumentscannerimpl.java:606) 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.ibatis.parsing.XPathParser.createDocument ( xpathparser.java:251) ...   More</span>

Workaround: 1. Check the XML header file and the right-click property for the same encoding 2. Try to add the following configuration to the Pom.xml:

<build>  
<resources>  
    <resource>  
        <directory>src/main/resources</directory >  
        <filtering>true</filtering>  
    </resource>  
</resources>  
  
<plugins >  
    <plugin>  
        <groupId>org.apache.maven.plugins</groupId>  
        <artifactId> maven-resources-plugin</artifactid>  
        <configuration>  
            <encoding>utf-8</encoding >  
        </configuration>  
    </plugin>  
             </plugins>  
</build>  
On this basis, add a few considerations, if the configuration to ensure that the following is not a problem, or not, use the same way:

1: Check workspace working directory encoding is not UTF-8

2: Check the code of the project

3: Check if the encoding of the. xml file matches the header encoding of the XML file

The basic configuration of these three items, will not appear above problems.

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.