1、问题描述
问题形式:Mapped Statements collection does not contain value
### Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.cn.myssm.dao.user.UserMapper.getUserList
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.cn.myssm.dao.user.UserMapper.getUserList
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
at com.sun.proxy.$Proxy6.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)
at com.cn.myssm.dao.user.UserMapperImpl.getUserList(UserMapperImpl.java:27)
at com.cn.myssm.service.UserServiceImpl.findUsersWithConditions(UserServiceImpl.java:14)
at TestSpringMybatis.main(TestSpringMybatis.java:22)
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.cn.myssm.dao.user.UserMapper.getUserList
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.cn.myssm.dao.user.UserMapper.getUserList
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
... 5 more
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.cn.myssm.dao.user.UserMapper.getUserList
at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:888)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:721)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:714)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
... 11 more
Exception in thread "main" 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.cn.myssm.dao.user.UserMapper.getUserList
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.cn.myssm.dao.user.UserMapper.getUserList
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
at com.sun.proxy.$Proxy6.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)
at com.cn.myssm.dao.user.UserMapperImpl.getUserList(UserMapperImpl.java:27)
at com.cn.myssm.service.UserServiceImpl.findUsersWithConditions(UserServiceImpl.java:14)
at TestSpringMybatis.main(TestSpringMybatis.java:22)
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.cn.myssm.dao.user.UserMapper.getUserList
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.cn.myssm.dao.user.UserMapper.getUserList
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
... 5 more
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.cn.myssm.dao.user.UserMapper.getUserList
at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:888)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:721)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:714)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
... 11 more
2、解决方法:
是因为命名空间没写对
<mapper namespace="com.cn.myssm.dao.user.UserMapper">