在mybatis配置文件config.xml中报错:

The content of element type "configuration" must match
"(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,reflectorFactory?,plugins?,environments?,databaseIdProvider?,mappers?)".

是因为配置信息的顺序放置错误,应遵循:

元素类型“配置”的内容必须匹配
“(属性?,设置?,typealiases?,typehandlers?、化?,objectwrapperfactory?,reflectorfactory?,插件吗?,环境?,databaseidprovider?,映射?)”。

示例代码

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://www.mybatis.org/dtd/mybatis-3-config.dtd">
<!--configuration根标签-->
<configuration> <!-- 二、(1) 定义实体bean名和数据库列名相对应 type:实体的路径 alias:实体的别名 -->
<typeAliases>
<typeAlias type="com.ckx.entity.User" alias="User" />
</typeAliases> <!--二、 (2) 引入关系映射文件!!!这里有严格顺序!不能放在数据源配置前-->
<mappers>
<mapper resource="com.ckx.entityMapper.UserMapper.xml" />
</mappers> <!--一、 配置环境信息-->
<environments default="admin">
<environment id="admin">
<!-- 指定事务管理机制-->
<transactionManager type="JDBC"></transactionManager>
<!-- 配置数据源 POOLED: 连接池-->
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/ceshi?useUnicode=true&amp;characterEncoding=utf8" />
<property name="username" value="root" />
<property name="password" value="123456" />
</dataSource>
</environment>
</environments> </configuration>

改变顺序即可消除错误:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://www.mybatis.org/dtd/mybatis-3-config.dtd">
<!--configuration根标签-->
<configuration> <!-- 二、(1) 定义实体bean名和数据库列名相对应 type:实体的路径 alias:实体的别名 -->
<typeAliases>
<typeAlias type="com.ckx.entity.User" alias="User" />
</typeAliases> <!--一、 配置环境信息-->
<environments default="admin">
<environment id="admin">
<!-- 指定事务管理机制-->
<transactionManager type="JDBC"></transactionManager>
<!-- 配置数据源 POOLED: 连接池-->
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/ceshi?useUnicode=true&amp;characterEncoding=utf8" />
<property name="username" value="root" />
<property name="password" value="123456" />
</dataSource>
</environment>
</environments> <!--二、 (2) 引入关系映射文件!!!这里有严格顺序!不能放在数据源配置前-->
<mappers>
<mapper resource="com.ckx.entityMapper.UserMapper.xml" />
</mappers> </configuration>

The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,reflectorFactory?,plugins?,environments?,databaseIdProv的更多相关文章

  1. The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?...

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC & ...

  2. 【转】The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?...

    [转]The content of element type "configuration" must match "(properties?,settings?,typ ...

  3. mybatis配置文件,注意标签配置顺序。否则报错The content of element type "configuration" must match "(properties?,settings?,...怎么解决

    感谢原作者http://www.cnblogs.com/zhoumingming/p/5417014.html 注意每个标签必须按照顺序写,不然就会提示错误 顺序是 <?xml version= ...

  4. 元素类型为 "configuration" 的内容必须匹配 "(properties?,settings?,typeAliases?,typeHandlers?

    报错主要部分如下: Error building SqlSession.### Cause: org.apache.ibatis.builder.BuilderException: Error cre ...

  5. Multiple annotations found at this line: - The content of element type "mapper" must match "EMPTY". - Attribute "namespace" must be declared for element type "mapper".

    今天在mybatis的mapper映射配置文件中遇到了这样的问题,困扰了我3个小时: Multiple annotations found at this line: - The content of ...

  6. The content of element type "package" must match "(result-types?,interceptors?...

    错误:“The content of element type "package" must match "(result-types?,interceptors?,de ...

  7. web.xml配置bug之提示The content of element type "web-app" must match "(icon?,display- name?,description?,distributable?,

    错误:配置web.xml时,出现红色叉叉,提示 The content of element type "web-app" must match "(icon?,disp ...

  8. The content of element type "beans" must match "(description?,(import|alias|bean)*)

    The content of element type "beans" must match "(description?,(import|alias|bean)*) - ...

  9. The content of element type "package" must match "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global- results?,global-exception-mappings?,action*)".

    报错 The content of element type "package" must match "(result-types?,interceptors?,def ...

随机推荐

  1. OJ上 G++ 与 C++ 的区别

    1.输出double类型时,如果采用G++提交,scanf采用%lf,prinf采用%f,否则会报错 2.使用GCC/G++的提醒: 对于64位整数, long long int 和 __int64 ...

  2. 面试题一 链表中倒数第k个结点

    void findLastK(LinkedNode head, int k, int n){ if (head == NULL || k == 0) return; LinkedNode t1 = h ...

  3. IO-同步,异步,阻塞,非阻塞

    IO-同步,异步,阻塞,非阻塞1.什么是IO数据在系统内核(kernel)和用户进程之间的传递,称为IO. 2.IO操作步骤以read为例,涉及两个系统对象,调用IO的process(or threa ...

  4. IE 11 保护模式害惨了我

    花了几乎两天,一直用IE, 就说好好的 动态域名 为什么一直不能访问.用其它浏览器一试,我哭了,都是好的.

  5. List remove注意点

    public class ListTest { public static void main(String[] args) { // TODO Auto-generated method stub ...

  6. WeX5学习笔记-建立项目且从SVN获取版本

    UI2项目(app项目)建立步骤: 1.从网上获得WeX5_V3.1.1.zip 文件,在某盘根目录下,创建一个文件,起名尽量短小,因开发包里的文件目录层次很深,有时会报路径长度超出范围的提示,如创建 ...

  7. WebApi:过滤器的种类

    WebApi:筛选器的种类 授权筛选器:这些筛选器用于实现IAuthorizationFilter和做出关于是否执行操作方法(如执行身份验证或验证请求的属性)的安全决策.AuthorizeAttrib ...

  8. Velocity $ 和$! 区别

    输出指令 ${}过滤输出 输出表达式的计算结果,并进行过滤,比如:过滤变量中的HTML标签. 格式: ${expression} 示例: ${user.name} 注:HTTL缺省开启了EscapeX ...

  9. C语言中数据类型取值范围的计算的理解与总结

    c语言中,数据类型有short,int,long,char,float,double,然后除了浮点型只有 有符号数(signed)外,其他的数据类型都分为有符号(signed)和无符号(unsigne ...

  10. 关于iscroll阻止浏览器默认动作

    使用iscroll时,移动端遇到需要长按复制功能,但是iscroll屏蔽了浏览器默认事件,所以实现不了. 解决方案: myScroll = new IScroll('#wrapper',{ preve ...