The content of element type configuration must match (properties?,setting

2024-06-01 06:38

本文主要是介绍The content of element type configuration must match (properties?,setting,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

在运行mybatis配置文件的时候,出现错误:

[html]  view plain  copy
  1. Caused by: org.xml.sax.SAXParseException: The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,plugins?,environments?,databaseIdProvider?,mappers?)".  
  2.     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)  
  3.     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)  
  4.     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)  
  5.     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)  
  6.     at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2017)  
  7.     at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:901)  
  8.     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)  
  9.     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)  
  10.     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)  
  11.     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)  
  12.     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)  
  13.     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)  
  14.     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)  
  15.     at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)  
  16.     at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)  
  17.     at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:254)  
  18.     ... 21 more  

配置文件如下:

[html]  view plain  copy
  1. <?xml version="1.0" encoding="UTF-8" ?>  
  2. <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"  
  3. "http://mybatis.org/dtd/mybatis-3-config.dtd">  
  4. <configuration>  
  5.     <properties resource="dbConfig.properties"></properties>  
  6.     <environments default="development">  
  7.         <environment id="development">  
  8.             <transactionManager type="JDBC" />  
  9.             <dataSource type="POOLED">  
  10.                 <property name="driver" value="${driver}" />  
  11.                 <property name="url" value="${url}" />  
  12.                 <property name="username" value="${dbuser}" />  
  13.                 <property name="password" value="${dbpassword}" />  
  14.             </dataSource>  
  15.         </environment>  
  16.     </environments>  
  17.     <mappers>  
  18.         <mapper resource="com/apps/dao/RemainDao.xml"/>  
  19.         <mapper resource="com/apps/dao/WorkSpaceDao.xml"/>  
  20.     </mappers>  
  21.     <typeAliases>  
  22.         <typeAlias type="com.apps.domain.Remian" alias="Remian"/>  
  23.         <typeAlias type="com.apps.domain.WorkSpace" alias="WorkSpace"/>  
  24.     </typeAliases>  
  25. </configuration>  

找了老半天,才发现配置文件 configuration 中的元素,不但有类型限制,也有顺序限制。必须按照(
[html]  view plain  copy
  1. match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,plugins?,environments?,databaseIdProvider?,mappers?)".  
)进行配置。修改配置文件


[html]  view plain  copy
  1. <?xml version="1.0" encoding="UTF-8" ?>  
  2. <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"  
  3. "http://mybatis.org/dtd/mybatis-3-config.dtd">  
  4. <configuration>  
  5.     <properties resource="dbConfig.properties"></properties>  
  6.     <typeAliases>  
  7.         <typeAlias type="com.apps.domain.Remian" alias="Remian"/>  
  8.         <typeAlias type="com.apps.domain.WorkSpace" alias="WorkSpace"/>  
  9.     </typeAliases>  
  10.     <environments default="development">  
  11.         <environment id="development">  
  12.             <transactionManager type="JDBC" />  
  13.             <dataSource type="POOLED">  
  14.                 <property name="driver" value="${driver}" />  
  15.                 <property name="url" value="${url}" />  
  16.                 <property name="username" value="${dbuser}" />  
  17.                 <property name="password" value="${dbpassword}" />  
  18.             </dataSource>  
  19.         </environment>  
  20.     </environments>  
  21.     <mappers>  
  22.         <mapper resource="com/apps/dao/RemainDao.xml"/>  
  23.         <mapper resource="com/apps/dao/WorkSpaceDao.xml"/>  
  24.     </mappers>     
  25. </configuration>  


之后可以通过.........

这篇关于The content of element type configuration must match (properties?,setting的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1020260

相关文章

解决Spring运行时报错:Consider defining a bean of type ‘xxx.xxx.xxx.Xxx‘ in your configuration

《解决Spring运行时报错:Considerdefiningabeanoftype‘xxx.xxx.xxx.Xxx‘inyourconfiguration》该文章主要讲述了在使用S... 目录问题分析解决方案总结问题Description:Parameter 0 of constructor in x

Vue项目中Element UI组件未注册的问题原因及解决方法

《Vue项目中ElementUI组件未注册的问题原因及解决方法》在Vue项目中使用ElementUI组件库时,开发者可能会遇到一些常见问题,例如组件未正确注册导致的警告或错误,本文将详细探讨这些问题... 目录引言一、问题背景1.1 错误信息分析1.2 问题原因二、解决方法2.1 全局引入 Element

element-ui下拉输入框+resetFields无法回显的问题解决

《element-ui下拉输入框+resetFields无法回显的问题解决》本文主要介绍了在使用ElementUI的下拉输入框时,点击重置按钮后输入框无法回显数据的问题,具有一定的参考价值,感兴趣的... 目录描述原因问题重现解决方案方法一方法二总结描述第一次进入页面,不做任何操作,点击重置按钮,再进行下

Android fill_parent、match_parent、wrap_content三者的作用及区别

这三个属性都是用来适应视图的水平或者垂直大小,以视图的内容或尺寸为基础的布局,比精确的指定视图的范围更加方便。 1、fill_parent 设置一个视图的布局为fill_parent将强制性的使视图扩展至它父元素的大小 2、match_parent 和fill_parent一样,从字面上的意思match_parent更贴切一些,于是从2.2开始,两个属性都可以使用,但2.3版本以后的建议使

Oracle type (自定义类型的使用)

oracle - type   type定义: oracle中自定义数据类型 oracle中有基本的数据类型,如number,varchar2,date,numeric,float....但有时候我们需要特殊的格式, 如将name定义为(firstname,lastname)的形式,我们想把这个作为一个表的一列看待,这时候就要我们自己定义一个数据类型 格式 :create or repla

Caused by: org.hibernate.MappingException: Could not determine type for: org.cgh.ssh.pojo.GoodsType,

MappingException:这个主要是类映射上的异常,Could not determine type for: org.cgh.ssh.pojo.GoodsType,这句话表示GoodsType这个类没有被映射到

JavaScript正则表达式六大利器:`test`、`exec`、`match`、`matchAll`、`search`与`replace`详解及对比

在JavaScript中,正则表达式(Regular Expression)是一种用于文本搜索、替换、匹配和验证的强大工具。本文将深入解析与正则表达式相关的几个主要执行方法:test、exec、match、matchAll、search和replace,并对它们进行对比,帮助开发者更好地理解这些方法的使用场景和差异。 正则表达式基础 在深入解析方法之前,先简要回顾一下正则表达式的基础知识。正则

springBoot 读取properties文件

1.创建maven工程,在pom文件中添加依赖 1 <parent>2 <groupId>org.springframework.boot</groupId>3 <artifactId>spring-boot-starter-parent</artifactId>4 <version>1.5.9.RELEASE</version>5 </parent>6

leetcode#496. Next Greater Element I

题目 You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1’s elements in the corresponding places of nums

How can I load the openai api configuration through js in html?

题意:怎样在HTML中通过JavaScript加载OpenAI API配置 问题背景: I am trying to send a request through js in my html so that openai analyzes it and sends a response, but if in the js I put the following: 我正在尝试通过HTM