### Error building SqlSession.

原创 2015年11月19日 20:06:53

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 more
Caused 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 configuration
PUBLIC "-//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、解决办法

版权声明:本文为博主原创文章,未经博主允许不得转载。

MyException--org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ###

org.apache.ibatis.exceptions.PersistenceException:  ### Error building SqlSession. ### The error m...

【MyBatis】常见错误记录

错误类型一: 错误提示:org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause:...

org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ### The error may

##报错代码 ``` org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ### T...

Mybatis配置文件报错“元素类型为 "configuration" 的内容必须匹配……”

原因: mybatis-config.xml配置文件配置时,要注意节点顺序 顺序同错误提示信息一致: 元素类型为 "configuration" 的内容必须匹配 "(properties?,se...

Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance

错误信息: Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: ### Error build...

idea中配置使用mybatis出现问题BuilderException

在Idea编辑其中配置使用Mybatis出现BuilderException问题,问题描述如下: 2015-07-16 15:43:32,751 DEBUG [org.apache.ibatis.l...

MyBatis的SqlSessionFactory的创建问题

MyBatis SqlSessionFactory Singleton

Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xm

mybatis解析xml配置文件出现异常: org.apache.ibatis.exceptions.PersistenceException:  ### Error building SqlSe...

Mybatis获取SqlSession时报空指针错误解决

今天开始接触Mybatis,在学习第一步时就遇到了一个空指针的错误,所以记录一下,免得以后再犯:具体错误如下Exception in thread "main" org.apache.ibatis.e...

MyException--org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ###

org.apache.ibatis.exceptions.PersistenceException:  ### Error building SqlSession. ### The error m...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:### Error building SqlSession.
举报原因:
原因补充:

(最多只允许输入30个字)