mybatis 配置错误 XML document structures must start and end within the same entity

JAVA就业套餐课:https://edu.csdn.net/combo/detail/1230

问题如下:

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: XML document structures must start and end within the same entity.
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:54)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:38)
	at com.aaa.test.Test.main(Test.java:16)
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:256)
	at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:120)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:63)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:51)
	... 2 more
Caused by: org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
	at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1411)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.endEntity(XMLDocumentFragmentScannerImpl.java:902)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.endEntity(XMLDocumentScannerImpl.java:605)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.endEntity(XMLEntityManager.java:1393)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1763)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanData(XMLEntityScanner.java:1242)
	at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanComment(XMLScanner.java:756)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanComment(XMLDocumentFragmentScannerImpl.java:1036)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2945)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
	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:807)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:254)
	... 5 more

 

解决方案


解决方案二:
根据提示的错误,问题在xml里面,应该是个某个标签的开始和结束不一致了
解决方案三:
你的配置文件有标签没结束
解决方案四:
大哥,你可以自家看看,我哪个标签没结束,我都检查了N回了
解决方案五:
XMLdocumentstructuresmuststartandendwithinthesameentity.xml文档结构必须开始结束使用同一标签.你的XML元素一定有一个,名称是错误的,这可能是因为你编码方式导致你的标签内加入了系统当前编码环境下不识别的编码字符.
解决方案六:
问题和楼主一样啊..郁闷
解决方案七:
xml里的中文注释,先加空格再接“-->”
解决方案八:
LZ看看com.ibatis.blackcoat.entity.blackcoat的类中属性是否与表blackcoat的字段一一对应呢
解决方案九:
楼主的问题解决没有,我也遇到同样的问题,束手无策,求帮忙
解决方案十:
我解决了经过仔细检查除了标签要写对应之外,就是之前楼上提到的那个中文注释问题,一定要前后空格隔开<!--说明-->

发布了805 篇原创文章 · 获赞 662 · 访问量 131万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 创作都市 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览