在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. webpack-dev-server、webpack-dev-middleware、webpack-hot-middleware区别

    webpack-dev-server: 它是一个静态资源服务器,只用于开发环境: webpack-dev-server会把编译后的静态文件全部保存在内存里: webpack-dev-middlewar ...

  2. javascript事件类型之界面拖拽交互

    一.在线DEMO 界面拖拽交互

  3. ADF_Controller系列5_通过绑定TasksFlow创建Train

    2015-02-14 Created By BaoXinjian

  4. git 服务器的搭建

    文章转载地址:http://www.linuxidc.com/Linux/2015-05/117502.htm 亲测可行,已经自己搭建一个正在使用中,搭建完成后,结合着pycharm +git,就能直 ...

  5. WebService---Android中访问WebService接口的方法

     最近公司有个项目需要从Android平台访问WebService接口,实现向发布的函数传递对象.在网上找了一些资料,发现使用ksoap2可以调用WebService传递对象.   需要引入ksoap ...

  6. oracle start with connect by prior 递归查询

    Oracle中的select语句可以用start with...connect by prior子句实现递归查询,connect by 是结构化查询中用到的, 其基本语法是: select ... f ...

  7. 导入Eclipse工程 到 Android Studio

    一.从Eclipse导入工程到Android Studio 根据官方的介绍,Android Studio可以兼容Eclipse的现有工程,但需要做一些操作: 首先升级ADT到最新版本,目前为版本号为2 ...

  8. powerDesigner 报Unable to connect SQLState=08004 解决方法

    在使用PowerDesigner配置数据库连接(configure connections)的时候,点击Test connection之后弹出Unable to connect SQLState=08 ...

  9. Haproxy+asp.net +RedisSessionStateProvider 完美实现负载均衡,并且session保持

    .net framework 4.5下测试成功,使用RedisSessionStateProvider 2.2.1保持session数据,通过Haproxy保持会话数据.首先在PM下安装RedisSe ...

  10. How to configure Veritas NetBackup (tm) to write Unified and Legacy log files to a different directory

    Problem DOCUMENTATION: How to configure Veritas NetBackup (tm) to write Unified and Legacy log files ...