2 qq 19446337 qq_19446337 于 2017.08.29 21:08 提问

myeclipse中mybatis查询数据库报错 10C

==============异常开始=============
==============异常结束=============
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 StudentMapper.studentListPage

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

at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364)
at com.sun.proxy.$Proxy15.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:194)
at com.fh.dao.DaoSupport.findForList(DaoSupport.java:121)
at com.fh.service.sc.student.impl.StudentService.listStudent(StudentService.java:20)
at com.fh.service.sc.student.impl.StudentService$$FastClassByCGLIB$$b393fbaf.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
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:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
at com.fh.service.sc.student.impl.StudentService$$EnhancerByCGLIB$$5b8121b.listStudent(<generated>)
at com.fh.controller.sc.StudentController.listStudent(StudentController.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

Caused by: org.apache.ibatis.exceptions.PersistenceException:

Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for StudentMapper.studentListPage

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

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:107)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98)
at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:354)
... 70 more

Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for StudentMapper.studentListPage
at org.apache
.ibatis.session.Configuration$StrictMap.get(Configuration.java:768)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:603)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:596)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:103)
... 75 more

3个回答

chenbaige
chenbaige   Rxr 2017.08.29 22:34

studentListPage是你dao层的一个方法?看看你dao层接口和mapper文件的id是不是对应的,还有mapper的namespace是不是接口的全路径。

qq_19865749
qq_19865749   2017.08.30 08:47
  java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for StudentMapper.studentListPage

没用过Mybatis, 但从提示信息看,你是不是在一个实体A中定义了一个集合,用于对应一对多关系的另一个实体B?你这是Persistent出错,所以看看实体A的studentListPage 是否的定义了级联插入。还有个可能是没有初始化该集合,应该初始化,如:

 private Set<实体B> studentListPage = new HashSet<>();
baidu_26611019
baidu_26611019   2017.08.30 08:55

Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for StudentMapper.studentListPage
这个报错很清楚了:逻辑错误,映射文件中没有StudentMapper.studentListPage对应的项。
查看你的映射路径,多半是没对应上,仔细检查应该不难发现问题
实在没办法就把你的conf.xml xxxMaper.xml dao 文件发出来帮你找

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
在 Spring Boot @Configuration 注解类中使用 Mybatis 查询数据库启动报错
场景想在 Spring Boot 启动时使用 guava 缓存,将数据库的部分内容放入缓存中,所以写了一个 CacheConfig 类,但是在启动过程中报错,错误为:@Configuration public class CacheConfig {}Mapped Statements collection does not contain value for com.xxx.xxx.dao.Scor
关于Myeclipse使用mybatis出现Jar包冲突的解决办法
关于Myeclipse使用mybatis出现Jar包冲突的解决办法,这样操作之后不用每次部署都要删Jar包。(因为我们要使用Mybatis,所以使用Myeclipse里面自带的Mapper功能不全,是1.0.0版,所以我们要下最新一点的Mapper Jar包才能更好的使用)
myeclipse(亲测可用)下Mybatis Generator插件的安装
重装了myeclipse之后,一些配置插件又没有了,今天想装一下Mybatis Generator插件,资源文件不好找,还有就是教程不清晰。自己记录一下,方便其他人查看安装。 插件下载地址:http://download.csdn.net/download/gxl442172663/7624747 下载下来之后解压,会有两个文件夹 步骤: 1、关闭myeclipse 2、
mybatis中xml文件第一行报错解决办法
将   "-//mybatis.org//DTD Mapper 3.0//EN" "color: #ff9900;">http://mybatis.org/dtd/mybatis-3-mapper.dtd">   改为   "-//mybatis.org//DTD Mapper 3.0//EN" "color: #ff9900;">http://www.mybatis.org/dtd/myb
MyEclipse开启Mybatis-config.xml配置文件智能提示
使用Java开发的程序员一般在学习的时候,可能都会涉及到使用配置文件,在使用Eclipse类似IDE进行编辑配置配置文件的时候,如果配置文件不能自动联想,是一件比较恼人的事情。笔者这里拿mybatis配置不能自动提示来举例。 问题描述 在参考官方文档进行学习的时候,发下如下的配置代码在IDE中不能够自动提示。 <!DOCTYPE configuration PUBLIC "-//myb
MyEclipse上整合spring,mybatis报错
myeclipse报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):XXX 大多数情况下,很多人会选择eclipse作为三大框架的工具,然而有些人还是会选择myeclipse,比如我,和大家的开发工具不一样又报错的时候就悲剧了,好吧,我今天就悲剧了一场!!!在整合Struts2,sprin
myeclipse中配置mybatis的自动提示
首先找到xml配置文件的这样一句话: "http://mybatis.org/dtd/mybatis-3-config.dtd"> 然后在myeclipse中打开Window -->Preferences --> XML --> XML  Catalog 点add,跳出对话框,添加location,key type和key location:是你下载dtd的本机位置
myeclipse或eclipse引入mybatis
注意:mybatis的使用,需要引入插件的jar包! 首先下载插件:插件下载 替换已经存在的文件,启动 myeclipse或eclipse 表示安装成功 作者:ajlgl 出处:http://blog.csdn.net/ajlgl 本文采用知识共享署名-非商业性使用-相同方式共享 2.5 中国大陆许可协议进行许可,欢迎
spring mybatis的多线程查询功能
最近几天写我的自己的项目的时候用到数据的实例化,这个要求多张表查询数据源,当时我是想的直接按照顺序进行查询然后在通过map集合返回到前台,但是感觉这样数据量一高 估计前端等待时间有点久。所以我想起用多线程的方式去同时查询数据返回。 * 类名称:ThreadPoolUtil * 类描述:线程池查询 * 创建人:fulln * 创建时间:2018年1月25日 下午7:1
Myeclipse中Mybatis Generator插件的简单使用
Myeclipse中Mybatis Generator插件的简单使用