java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for

java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for

异常的出现

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.xxxx.order.dao.task.OrderMapper.findAddressOrderBlackList
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.xxxx.order.dao.task.OrderMapper.findAddressOrderBlackList

原因

MappedStatement集合里面不包含这个方法,MyBatis会根据xml文件生成MappedStatement放到Configuretion中,如果找不到,有可能是对应的xml找不到,或者xml中没有id为findAddressOrderBlackList语句。

探索

报错
dao
从Configuration中获得MappedStatement
异常就是从get方法抛出的
果然就是这里

sch:在很久之前页遇到过同样的问题,原因是xml文件的namespace不对,也导致从MappedStatement的集合中查询不到。最近在阅读MyBatis源码,所以一看就知道是什么原因导致的了。
上次的链接:
http://www.jianshu.com/p/322a2c897352

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容