java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for org.fkit
来源:互联网 发布:阿里云服务器租用合同 编辑:程序博客网 时间:2024/06/06 02:08
报错信息:
Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for org.fkit.mapper.StudentMapper.selectStudent### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for org.fkit.mapper.StudentMapper.selectStudentat org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:111)at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102)at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98)at org.fkit.test.SelectStudentTest.main(SelectStudentTest.java:12)Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for org.fkit.mapper.StudentMapper.selectStudentat org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:797)at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:631)at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:624)at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:107)... 3 more
报错来源:在mybatis中进行查询时,运行代码报错误,错误的意思时:映射语句没有org.fkit.mapper.StudentMapper.selectStudent
在我的mybatis-config.xml中配置信息是:
<mappers><mapper resource="org/fkit/mapper/UserMapper.xml"/></mappers>并没有配置StudentMapper的映射,所以在启动程序时,mybatis不知道去哪里找持久化类的映射文件了
正确的配置是:
<mappers><mapper resource="org/fkit/mapper/UserMapper.xml"/><mapper resource="org/fkit/mapper/StudentMapper.xml"/></mappers>遇到这样的错误,不仅仅是映射文件没有配置,总的来说:
1、mapper.xml中没有加入namespace
2、mapper.xml中的方法和接口mapper的方法不对应
3、mapper.xml没有加入到mybatis-config.xml中(即总的配置文件),例外:配置了mapper文件的包路径的除外
4、mapper.xml文件名和所写的mapper名称不相同。
1 0
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for org.fkit
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for /package
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- MyBatis异常java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- MyBatis:java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for...
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for %
- mybatis错误java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.ph51
- MyBatis出现java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- mybatis:java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for U
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- 【Mybatis】java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for study.my
- 解决mybatis,java.lang.IllegalArgumentException Mapped Statements collection does not contain value for
- stl---vector详解
- Linux服务器宕机案例
- Apache中 RewriteRule 规则参数介绍
- c++实验3-个人所得税计算器
- Java基本类型的一些总结
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for org.fkit
- 定位position
- 菜鸟的我
- linux快速生成大文件
- 银行卡号4位一空格
- 蓝桥杯模拟赛 猜算式
- CentOS更改yum源与更新系统
- Maven学习笔记(一)
- JS 闭包问题- for循环取 i