当前位置: 代码迷 >> Ruby/Rails >> # Error building SqlSession
  详细解决方案

# Error building SqlSession

热度:466   发布时间:2016-04-29 02:08:16.0
### Error building SqlSession.

1、错误描述

Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession.### Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 93; 对实体 "characterEncoding" 的引用必须以 ';' 分隔符结尾。	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:79)	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:63)	at com.you.demo.Mybatis.main(Mybatis.java:45)Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 93; 对实体 "characterEncoding" 的引用必须以 ';' 分隔符结尾。	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:253)	at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:122)	at org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:72)	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:76)	... 2 moreCaused by: org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 93; 对实体 "characterEncoding" 的引用必须以 ';' 分隔符结尾。	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)	at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)	at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:890)	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanAttribute(XMLDocumentFragmentScannerImpl.java:1547)	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1319)	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)	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)	... 5 more

2、错误原因

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE configurationPUBLIC "-//mybatis.org//DTD Config 3.0//EN""http://mybatis.org/dtd/mybatis-3-config.dtd"><configuration>    <environments default="development">        <transactionManager type="JDBC"/>        <dataSource type="POOLED">            <property name="driver"                value="com.mysql.jdbc.Driver"/>            <property name="url"                 value="***************"/>            <property name="username" value="**************"/>            <property name="password" value="*************"/>        </dataSource>    </environments></configuration>


3、解决办法

  相关解决方案