在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. OpenGL矩阵类(C++)

    概述 创建&初始化 存取器 矩阵运算 变换函数 实例:模型视图矩阵 实例:投影矩阵 概述 OpenGL固定功能管线提供4个不同类型的矩阵(GL_MODELVIEW.GL_PROJECTION. ...

  2. DuoCode测试

    http://duoco.de/ DuoCode 只能引用自己编译的DLL,不能引用外部DLL.这么做可以保证”代码编得过,就一定能跑“. SharpKit 遇到过这样的问题.在代码中使用了 list ...

  3. lua学习记录

    1.八种数据类型:number,string,boolean,nil,function,table,协程,自定义类型 空字符串和数字0是真,false和nil为假2.lua是动态语言,每个变量携带自己 ...

  4. 三个loading小动画实例

    直接贴代码: <!DOCTYPE html><html><head>    <meta charset="utf-8">    &l ...

  5. knockout 第一个实例visible

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  6. c#定义全局条件编译符号

    在"工程"上单机右键,"属性"--->"生成"--->"条件编译符号"后边的输入框中,输入自定义的条件编译变 ...

  7. mysql 启动 pid报错解决方法

    在安装好mysqld的时候 启动的时候报错如下: [root@ mysql]# service mysqld start Starting MySQL.The server quit without ...

  8. IIS:日志代码分析

    如何看IIS日志代码,打开IIS日志后,你会看见里面有很多访问记录.baiduspider,Googlebot等就是蜘蛛了.蜘蛛爬过后都会留下记录的,状态代码列在下面: 100 - 表示已收到请求的一 ...

  9. 必须使用“角色管理工具”安装或配置Microsoft .NET Framework 3.5 SP1

    在Windows Server 2008下直接安装SQL Server 2008时,会出现如下错误: 必须使用“角色管理工具”安装或配置Microsoft .NET Framework 3.5 SP1 ...

  10. 快速求n的质因子(数论)

    快速求n的质因子 如何尽快地求出n的质因子呢?我们这里又涉及两个好的算法了! 第一个:用于每次只能求出一个数的质因子,适用于题目中给的n的个数不是很多,但是n又特别大的 #include<std ...