org.xml.sax.SAXParseException: The content of element type "configuration" must match
2014-09-15 23:54
543 查看
在mybatis的配置文件中新增加<databaseIdProvider type="VENDOR">节点后,原来正确的配置文件立即变得不可用了,出现的错误信息如下:
异常中的信息已经描述得比较清楚了:
org.xml.sax.SAXParseException: The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,plugins?,environments?,databaseIdProvider?,mappers?)".
其实就是mybatis配置文件中的各节点必须按照properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,plugins?,environments?,databaseIdProvider?,mappers?
顺序排列。如果把databaseIdProvider写到mappers后边,立即就抛出如上异常。将其移动到mappers前边后,mybatis就能正确解析节点了。
这坑爹的mybatis...
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: The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,plugins?,environments?,databaseIdProvider?,mappers?)". 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 testMybatis.Test.main(Test.java:20) Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException: The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,plugins?,environments?,databaseIdProvider?,mappers?)". 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: The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,plugins?,environments?,databaseIdProvider?,mappers?)". at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2017) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:901) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2939) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) 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:119) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:232) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284) at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:251) ... 5 more
异常中的信息已经描述得比较清楚了:
org.xml.sax.SAXParseException: The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,plugins?,environments?,databaseIdProvider?,mappers?)".
其实就是mybatis配置文件中的各节点必须按照properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,plugins?,environments?,databaseIdProvider?,mappers?
顺序排列。如果把databaseIdProvider写到mappers后边,立即就抛出如上异常。将其移动到mappers前边后,mybatis就能正确解析节点了。
这坑爹的mybatis...
相关文章推荐
- mybatis-config.xml:报SAXParseException: The content of element type "configuration" must match
- "org.xml.sax.SAXParseException: The content of element type "class" must match" 异常解决
- org.xml.sax.SAXParseException The content of element type "package" must match "(result-types?,inter
- org.xml.sax.SAXParseException: The content of element type “sqlMapConfig” must match “(properties?,s
- org.xml.sax.SAXParseException: The content of element type “sqlMapConfig” must match “(properties?,s
- xml解析org.xml.sax.SAXParseException: The element type "comment" must
- org.xml.sax.SAXParseException: The prefix "context" for element "context:component-scan" is not boun
- struts-config.xml配置文件顺序异常: The content of element type "struts-config" must match
- SpringMVC+idea中web.xml文件的The content of element type "web-app" must match问题
- org.xml.sax.SAXParseException: Attribute "colum" must be declared for element type "result".
- Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'xml-bod
- 解决web.xml 报错The content of element type "web-app" must match
- Error parsing XML. org.xml.sax.SAXParseException: Element type "sqlMapConfig" must be declared出错解决方法
- Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
- org.xml.sax.SAXParseException: Element type "beans" must be followed by either attribute specifications, ">" or "/>".
- org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or
- web.xml中提示错误The content of element type "web-app" must match
- org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
- SAXParseException: The content of element type “sqlMapConfig” 解决方案
- org.xml.sax.SAXParseException: Document root element "struts-config", must match