在mybatis的配置文件中新增加<databaseIdProvider type="VENDOR">节点后,原来正确的配置文件立即变得不可用了,出现的错误信息如下:
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...
相关推荐
在XML Schema设计中,"cvc-complex-type.2.4.d: Invalid content was found" 是一个常见的错误信息,这通常意味着在解析XML文档时,遇到了不符合定义的复杂类型的内容。这个错误通常涉及到XML Schema的约束规则,即...
总的来说,当遇到`SAXParseException:cvc-elt.1: 找不到元素“beans”的声明`这样的错误时,应首先检查XML配置文件的结构和命名空间,然后排查可能的编码和解析器问题。一旦找到问题,修复后通常能成功解析并加载...
javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing '- WSDL Document -'.: org.xml.sax.SAXParseException: The element type "p" must be terminated by the matching end-tag ...
首先,让我们来看看标题和描述中提到的具体错误:"org.xmlpull.v1.XmlPullParserException: PI must not start with xml" 和 "org.xml.sax.SAXParseException: PI must not start with xml"。这两个错误都是由于XML...
org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'area'. One of '{MathWorksID, type}' is expected. 运行hosaver: Warning: Could not find an exact ...
BeRoot, 特权升级项目 Windows/Linux/Mac BeRoot项目BeRoot项目是一个发布工具,用于检查常见的以找到一种方法来升级我们的特权。它已经被添加到 pupy 项目作为一个post开发模块( 所以它将在内存中执行而不需要触摸...
好多版本是会报错的,[Fatal Error] :24:28: An ... org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0xd863) was found in the element content of the documen.,这个版本是纠正过后重新打包做的
好多版本是会报错的,[Fatal Error] :24:28: An ... org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0xd863) was found in the element content of the documen.,这个版本是纠正过后重新打包做的
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://code.alibabatech.com/schema/dubbo/dubbo.xsd', because... 3) the root element of the document is not <xsd:schema>.
nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null". ``` 此错误提示表明在`applicationContext.xml`配置文件的第4行存在语法错误,具体是文档...
Web服务是一种基于标准的、平台无关的通信方式,允许不同系统之间进行数据交换。本篇文章将深入探讨三个流行的Java Web Service框架:XFire、CXF和Axis,它们都是用于构建和消费Web服务的重要工具。...
在使用zk框架开发的过程中,尝试加载`/group/salegroup/index.zul`页面时遇到了`SAXParseException:Contentisnotallowedintrailingsection`的错误。 **解决方案**: 1. **分析原因**: - 错误提示表明XML文档结构...
- DTD(Document Type Definition)或XML Schema:用于定义XML文档的结构和数据类型。 2. **Java DOM解析**: - DOM API:DOM解析器将整个XML文档加载到内存中形成一个树形结构,称为DOM树。主要包括`Document`、...
解决启动dubbo项目的时候出现,无法读取方案文档 'http://code.alibabatech.com/schema/dubbo/dubbo.xsd',其实在你本地把dubbo.jar文件解压,然后在META-INF下边就有个dubbo.xsd,就是他
String content = element.getTextContent(); // 处理元素内容... } } } catch (Exception e) { e.printStackTrace(); } ``` 总结来说,Android上使用DOM解析XML是一种常见且强大的方法,适用于处理小到中等...
Question one:mybatis配置文件标签组成及排序 Caused by: org.apache.ibatis.... 元素类型为 “configuration” 的内容必须匹配 “(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWra
在TestParseXML源码中,可能会包含XML解析异常处理,如`SAXParseException`和`IOException`,以及对解析结果的验证和处理逻辑。理解这些代码将有助于深入掌握XML解析技术,并在实际项目中有效利用。
然而,在配置过程中,如果遇到“元素 'context:component-scan' 的前缀 'context' 未绑定”的错误,这意味着Spring无法识别和解析这个元素,因为缺少了对应的命名空间定义。 这个问题的根源在于XML配置文件中没有...
DOM解析器会抛出异常,如SAXParseException,需要捕获并适当地处理这些异常。 9. **XPath与DOM结合**:XPath是一种强大的查询语言,用于在XML文档中查找信息。通过JAXP(Java API for XML Processing),Java可以...
- 在处理XML时,需要处理异常,如`SAXParseException`、`IOException`等。 - 路径问题,如描述中提到的,需要根据实际情况调整XML文件的读取路径。 5. **示例代码**: ```java DocumentBuilderFactory factory ...