Mapped Statements collection does not contain value for xxx.xxx 错误原因&解决方案

少年击剑更吹箫,剑气箫心一例消。这篇文章主要讲述Mapped Statements collection does not contain value for xxx.xxx 错误原因& 解决方案相关的知识,希望能为你提供帮助。
 
先贴出详细的报错信息

2019-11-05 10:10:00 [executor-1] ERROR [org.quartz.core.JobRunShell:225] - Job DEFAULT.effectToothInsuranceJobDetail threw an unhandled Exception: org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method \'effectToothInsurance\' on target class [class com.xxx.mcc.common.QuartzSrvBean] failed; nested exception is 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 PatientInsuranceInfo.findPatientInsuranceInfoByCondition ### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for PatientInsuranceInfo.findPatientInsuranceInfoByCondition at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:273) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86) at org.quartz.core.JobRunShell.run(JobRunShell.java:216) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: 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 PatientInsuranceInfo.findPatientInsuranceInfoByCondition ### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for PatientInsuranceInfo.findPatientInsuranceInfoByCondition at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371) at com.sun.proxy.$Proxy8.selectList(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:198) at com.xxx.mcp.dao.PatientInsuranceInfoDAO.findPatientInsuranceInfoByCondition(PatientInsuranceInfoDAO.java:22) at com.xxx.mcp.service.impl.PatientInsuranceInfoServiceImpl.effectToothInsurance(PatientInsuranceInfoServiceImpl.java:37) 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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at com.sun.proxy.$Proxy28.effectToothInsurance(Unknown Source) at com.xxx.mcc.common.QuartzSrvBean.effectToothInsurance(QuartzSrvBean.java:52) 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.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273) at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:264) ... 5 more Caused by: org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for PatientInsuranceInfo.findPatientInsuranceInfoByCondition ### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for PatientInsuranceInfo.findPatientInsuranceInfoByCondition at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:122) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:113) 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:358) ... 29 more Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for PatientInsuranceInfo.findPatientInsuranceInfoByCondition at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:832) at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:665) at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:658) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:119) ... 35 more 2019-11-05 10:10:00 [executor-1] ERROR [org.quartz.core.ErrorLogger:2339] - Job (DEFAULT.effectToothInsuranceJobDetail threw an exception. org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method \'effectToothInsurance\' on target class [class com.xxx.mcc.common.QuartzSrvBean] failed; nested exception is 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 PatientInsuranceInfo.findPatientInsuranceInfoByCondition ### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for PatientInsuranceInfo.findPatientInsuranceInfoByCondition] at org.quartz.core.JobRunShell.run(JobRunShell.java:227) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method \'effectToothInsurance\' on target class [class com.xxx.mcc.common.QuartzSrvBean] failed; nested exception is 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 PatientInsuranceInfo.findPatientInsuranceInfoByCondition ### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for PatientInsuranceInfo.findPatientInsuranceInfoByCondition at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:273) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86) at org.quartz.core.JobRunShell.run(JobRunShell.java:216) ... 3 more Caused by: 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 PatientInsuranceInfo.findPatientInsuranceInfoByCondition ### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for PatientInsuranceInfo.findPatientInsuranceInfoByCondition at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371) at com.sun.proxy.$Proxy8.selectList(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:198) at com.xxx.mcp.dao.PatientInsuranceInfoDAO.findPatientInsuranceInfoByCondition(PatientInsuranceInfoDAO.java:22) at com.xxx.mcp.service.impl.PatientInsuranceInfoServiceImpl.effectToothInsurance(PatientInsuranceInfoServiceImpl.java:37) 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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at com.sun.proxy.$Proxy28.effectToothInsurance(Unknown Source) at com.xxx.mcc.common.QuartzSrvBean.effectToothInsurance(QuartzSrvBean.java:52) 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.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273) at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:264) ... 5 more Caused by: org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for PatientInsuranceInfo.findPatientInsuranceInfoByCondition ### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for PatientInsuranceInfo.findPatientInsuranceInfoByCondition at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:122) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:113) 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:358) ... 29 more Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for PatientInsuranceInfo.findPatientInsuranceInfoByCondition at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:832) at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:665) at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:658) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:119) ... 35 more

 
我遇到这个问题的原因是mapper.xml 没有加入到 mybatis-config.xml 中
 
下面总结网上收集到其他可能产生同样报错的原因
 
Mapped  Statements  collection  does  not  contain  value  for后面是什么类什么方法之类的: 
错误原因有几种: 
1、mapper.xml中没有加入namespace 
2、mapper.xml中的方法和接口mapper的方法不对应 
3、mapper.xml没有加入到mybatis-config.xml中(即总的配置文件),例外:配置了mapper文件的包路径的除外 
4、mapper.xml文件名和所写的mapper名称不相同。
 
 
 
参考:
https://bbs.csdn.net/topics/390656730?page=1
【Mapped Statements collection does not contain value for xxx.xxx 错误原因& 解决方案】https://bbs.csdn.net/topics/390306821
https://blog.csdn.net/zkn_cs_dn_2013/article/details/48007781
 
原文链接:
https://www.cnblogs.com/poterliu/p/11804985.html
 
 

    推荐阅读