修改MyBatis配置文件时,添加typeAliases节点,报了一个BuilderException:

org.apache.ibatis.exceptions.PersistenceException:
### Error building SqlSession.
### Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 35; columnNumber: 17; 元素类型为 "configuration" 的内容必须匹配 "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,plugins?,environments?,databaseIdProvider?,mappers?)"。
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:82)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:66)

原因是Mybatis3.X 的版本使用的 dtd 作为 XML 的格式校验文档。 而在 XML 规范中,dtd 是有严格的顺序的,在报错的异常中已经列出了对应的顺序,应该为:

properties>settings>typeAliases>typeHandlers>objectFactory>objectWrapperFactory>plugins>environments>databaseIdProvider>mappers

MyBatis 元素类型为 "configuration" 的内容必须匹配 ".....的更多相关文章

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

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

  2. 解决 Mybatis 元素类型为 "resultMap" 的内容必须匹配 "(constructor?,id*,result*,association*,collection*,discriminat

    在配置 mybatis mapper.xml文件时, 一不小心就会报如下类似的异常: Caused by: org.springframework.beans.factory.BeanCreation ...

  3. 错误Mybatis 元素类型为 "resultMap" 的内容必须匹配 "(constructor?,id*,result*,association*,collection*,discriminat

    今天算是见识了什么事顺序的重要性. 在使用mybatis时由于联合了其他的表,用到了resultMap,之后外加association这一项.可是在替换对应字段的位置上加上association总是报 ...

  4. Mybatis 元素类型为 "resultMap" 的内容必须匹配 "(constructor?,id*,result*,association*,collection*,discriminat

    <resultMap id="BaseResultMap" type="com.youotech.tl_cons_credit_rating.entity.TL_C ...

  5. org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 32; 元素类型为 "key" 的内容必须匹配 "(column)*"

    报错:部分错误信息,主要查看CauseBy Caused by: org.hibernate.InvalidMappingException: Unable to read XML at org.hi ...

  6. Caused by: 元素类型为 "package" 的内容必须匹配 "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global-results?,global-exception-mappings?,action*)"

    Caused by: 元素类型为 "package" 的内容必须匹配 "(result-types?,interceptors?,default-interceptor- ...

  7. Struts配置文件报错"元素类型为 "package" 的内容必须匹配"

    报错信息 元素类型为 "package" 的内容必须匹配 "(result-types?,interceptors?,default-interceptor-ref?,d ...

  8. mybatis下报错:元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap

    今天使用别人的代码报错,但是有时又不报错原来是配置文件的顺序要遵守 注意 "必须匹配" 四个字, 其意味着顺序很重要, 必须要一致, 试试将 resultMap 中各元素的顺序修改 ...

  9. 元素类型为 "package" 的内容必须匹配 "(result-types?,interceptors?,default-interceptor-ref?

    该错误为struts.xml内配置文件节点顺序错误. package内的元素节点必须按照以下顺序排放:  result-types         interceptors         defau ...

随机推荐

  1. javascript设计模式与开发实践阅读笔记(7)——迭代器模式

    迭代器模式:指提供一种方法顺序访问一个聚合对象中的各个元素,而又不需要暴露该对象的内部表示. 迭代器模式可以把迭代的过程从业务逻辑中分离出来,在使用迭代器模式之后,即使不关心对象的内部构造,也可以按顺 ...

  2. 详解eNSP下的单臂路由模拟实验配置

    不同VLAN之间的通信可以通过两种方式:单臂路由和三层交换机.其中,单臂路由是通过路由子接口,交换机的某个端口以trunk的方式与路由器的某个端口相连,同时路由器的链接端口配置子接口,配置子接口承载的 ...

  3. C# .net中获取台式电脑中串口设备的名称

    来源:http://www.cnblogs.com/hshuzhao/p/4028856.html?utm_source=tuicool&utm_medium=referral .情境: 做项 ...

  4. asp.net关于页面不回发的问题,寻求完美解决方案

    原文地址:http://www.sufeinet.com/thread-4564-1-1.html 这个问题我相信有不少人见过,就是使用系统的分页功能时,或者是使用系统控件,都会有一个回发的功能, 这 ...

  5. CAN Timing Sample Point

    typedef struct { //char name[ 16 ]; // Name of the CAN controller hardware //uint32_t ref_clk; // CA ...

  6. 今天踩过的坑——structs和phpmyadmin

    phpmyadmin 错误:缺少 mcrypt 扩展解决mv -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/sudo php5enmo ...

  7. eclipse快捷键调试总结【转】

    http://www.cnblogs.com/yxnchinahlj/archive/2012/02/22/2363542.html (1)Ctrl+M --切换窗口的大小(2)Ctrl+Q --跳到 ...

  8. 解决 NDP40-KB2468871不能安装

    新机子 成功装了vs2010,然后装sql2012提示让装vs2012sp1,下载了sp1,装的时候,装到最后一个包NDP40-KB2468871的时候报错了 KB2468871安装失败 错误: Ex ...

  9. 在gradle 中使用ant 执行 “命令行”(CMD)不出日志解决方案

    因为gradle 好恶心,声明的任务,一定会事先运行一次,而任务追加的话就不会 例如: task hello(){ println "HelloWorld" } task hell ...

  10. 【Theano】安装Theano

    http://blog.csdn.net/niuwei22007/article/details/47684673 http://blog.csdn.net/m624197265/article/de ...