mybatis:the expression 'list' evaluated to a null value-尊龙官方平台

mybatis:the expression 'list' evaluated to a null value

el/2024/3/25 20:21:51

完整错误信息:

严重: servlet.service() for servlet [springmvc] in context with path [/xinghe-platform-web] threw exception [request processing failed; nested exception is org.mybatis.spring.mybatissystemexception: nested exception is org.apache.ibatis.builder.builderexception: the expression 'list' evaluated to a null value.] with root cause
org.apache.ibatis.builder.builderexception: the expression 'list' evaluated to a null value.at org.apache.ibatis.scripting.xmltags.expressionevaluator.evaluateiterable(expressionevaluator.java:40)at org.apache.ibatis.scripting.xmltags.foreachsqlnode.apply(foreachsqlnode.java:54)at org.apache.ibatis.scripting.xmltags.mixedsqlnode.apply(mixedsqlnode.java:32)at org.apache.ibatis.scripting.xmltags.dynamicsqlsource.getboundsql(dynamicsqlsource.java:40)at org.apache.ibatis.mapping.mappedstatement.getboundsql(mappedstatement.java:278)at org.apache.ibatis.executor.baseexecutor.query(baseexecutor.java:118)at sun.reflect.generatedmethodaccessor67.invoke(unknown source)at sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)at java.lang.reflect.method.invoke(unknown source)at org.apache.ibatis.plugin.invocation.proceed(invocation.java:49)at com.xinghe.frame.mybatis.flushcacheinterceptor.intercept(flushcacheinterceptor.java:61)at org.apache.ibatis.plugin.plugin.invoke(plugin.java:60)at com.sun.proxy.$proxy24.query(unknown source)at sun.reflect.generatedmethodaccessor67.invoke(unknown source)at sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)at java.lang.reflect.method.invoke(unknown source)at org.apache.ibatis.plugin.invocation.proceed(invocation.java:49)at com.xinghe.frame.mybatis.offsetlimitinterceptor.intercept(offsetlimitinterceptor.java:55)at org.apache.ibatis.plugin.plugin.invoke(plugin.java:60)at com.sun.proxy.$proxy24.query(unknown source)at org.apache.ibatis.session.defaults.defaultsqlsession.selectlist(defaultsqlsession.java:108)at org.apache.ibatis.session.defaults.defaultsqlsession.selectlist(defaultsqlsession.java:102)at sun.reflect.generatedmethodaccessor71.invoke(unknown source)at sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)at java.lang.reflect.method.invoke(unknown source)at org.mybatis.spring.sqlsessiontemplate$sqlsessioninterceptor.invoke(sqlsessiontemplate.java:358)at com.sun.proxy.$proxy17.selectlist(unknown source)at org.mybatis.spring.sqlsessiontemplate.selectlist(sqlsessiontemplate.java:198)at com.xinghe.platform.dao.resscoredao.getbyresourcelocalid(resscoredao.java:43)at com.xinghe.platform.service.resscoremanager.getbyresourcelocalid(resscoremanager.java:41)at com.xinghe.platform.service.resscoremanager$$fastclassbyspringcglib$$68ba2513.invoke()at org.springframework.cglib.proxy.methodproxy.invoke(methodproxy.java:204)at org.springframework.aop.framework.cglibaopproxy$cglibmethodinvocation.invokejoinpoint(cglibaopproxy.java:717)at org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:157)at org.springframework.transaction.interceptor.transactioninterceptor$1.proceedwithinvocation(transactioninterceptor.java:99)at org.springframework.transaction.interceptor.transactionaspectsupport.invokewithintransaction(transactionaspectsupport.java:281)at org.springframework.transaction.interceptor.transactioninterceptor.invoke(transactioninterceptor.java:96)at org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:179)at org.springframework.aop.framework.cglibaopproxy$dynamicadvisedinterceptor.intercept(cglibaopproxy.java:653)at com.xinghe.platform.service.resscoremanager$$enhancerbyspringcglib$$9b94cd4.getbyresourcelocalid()at com.xinghe.platform.action.resresourcepublic.getscore(resresourcepublic.java:433)at sun.reflect.nativemethodaccessorimpl.invoke0(native method)at sun.reflect.nativemethodaccessorimpl.invoke(unknown source)at sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)at java.lang.reflect.method.invoke(unknown source)at org.springframework.web.bind.annotation.support.handlermethodinvoker.invokehandlermethod(handlermethodinvoker.java:177)at org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter.invokehandlermethod(annotationmethodhandleradapter.java:446)at org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter.handle(annotationmethodhandleradapter.java:434)at org.springframework.web.servlet.dispatcherservlet.dodispatch(dispatcherservlet.java:943)at org.springframework.web.servlet.dispatcherservlet.doservice(dispatcherservlet.java:877)at org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:966)at org.springframework.web.servlet.frameworkservlet.doget(frameworkservlet.java:857)at javax.servlet.http.httpservlet.service(httpservlet.java:622)at org.springframework.web.servlet.frameworkservlet.service(frameworkservlet.java:842)at javax.servlet.http.httpservlet.service(httpservlet.java:729)at org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:291)at org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206)at org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52)at org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239)at org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206)at com.auth.filter.authorizationfilter.dofilterinternal(authorizationfilter.java:77)at org.springframework.web.filter.onceperrequestfilter.dofilter(onceperrequestfilter.java:107)at org.springframework.web.filter.delegatingfilterproxy.invokedelegate(delegatingfilterproxy.java:344)at org.springframework.web.filter.delegatingfilterproxy.dofilter(delegatingfilterproxy.java:261)at org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239)at org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206)at com.auth.filter.authenticationfilter.dofilterinternal(authenticationfilter.java:115)at org.springframework.web.filter.onceperrequestfilter.dofilter(onceperrequestfilter.java:107)at org.springframework.web.filter.delegatingfilterproxy.invokedelegate(delegatingfilterproxy.java:344)at org.springframework.web.filter.delegatingfilterproxy.dofilter(delegatingfilterproxy.java:261)at org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239)at org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206)at com.xinghe.activate.filter.activatefilter.dofilterinternal(activatefilter.java:52)at org.springframework.web.filter.onceperrequestfilter.dofilter(onceperrequestfilter.java:107)at org.springframework.web.filter.delegatingfilterproxy.invokedelegate(delegatingfilterproxy.java:344)at org.springframework.web.filter.delegatingfilterproxy.dofilter(delegatingfilterproxy.java:261)at org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239)at org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206)at org.springframework.web.filter.characterencodingfilter.dofilterinternal(characterencodingfilter.java:88)at org.springframework.web.filter.onceperrequestfilter.dofilter(onceperrequestfilter.java:107)at org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239)at org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206)at org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:219)at org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:106)at org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:502)at org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:142)at org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79)at org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:617)at org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:88)at org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:518)at org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1091)at org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:668)at org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1521)at org.apache.tomcat.util.net.nioendpoint$socketprocessor.run(nioendpoint.java:1478)at java.util.concurrent.threadpoolexecutor.runworker(unknown source)at java.util.concurrent.threadpoolexecutor$worker.run(unknown source)at org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61)at java.lang.thread.run(unknown source)

**环境:**java项目,springmvc mybatis框架,
此错误的源码位置:
看到 mybatissystemexception ,首先想到的是错误可能发生在resscoremapper.xml 文件中,但dao层直接与mapper.xml文件相关联,查看错误信息可以看到以下信息:
com.xinghe.platform.dao.resscoredao.getbyresourcelocalid(resscoredao.java:43)
我遇到的这个错误就发生在这里!
错误原因:

说起错误原因,这里犯了一个小儿科的错误,从别的dao文件中复制过来的代码,方法名改了,selectone 中调用的mapper中的命令空间及方法名忘记改了,所以导致此错误;
修正后如下:

由于 selectone sql返回多条记录时会出异常,所以这里改用:selectlist 。

2018-10-30更新

有小伙伴反应没看懂,我这里再详细说一下。
1、注意 selectone 和 selectlist,一个返回一条,一个返回多条。
2、mapper.xml里面是否存在对应的sql定义。看图:
在这里插入图片描述


http://www.ngui.cc/el/5127981.html

相关文章

mybatis:mapped statements collection does not contain value for xxx

完整错误信息: 十一月 03, 2015 10:01:08 上午 org.apache.catalina.core.standardwrappervalve invoke 严重: servlet.service() for servlet [springmvc] in context with path [/xinghe-platform-web] threw exception [request processing failed; nested exce…

如何从尊龙官方平台官网下载chrome浏览器离线安装包

如何从尊龙官方平台官网下载chrome浏览器离线安装包? 为什么要下载离线安装包? 经常需要用到,比如有一堆电脑要装要升级; 有不能翻墙的环境,又想用; 癖好,就爱收集安装包,哈哈……࿱…

ibm的云平台bluemix使用初体验——创建php web 应用程序,添加并使用语言翻译服务

概述 通过本文学习,你将能够在ibm的云平台bluemix上创建自己的php web 应用程序,添加并使用语言翻译服务,发布自己的php应用到云服务器上。 本地开发测试环境:windows 7 x64,php,nginx 有关本地分环境的搭建,请参考:thinkphp学习(一) windows下nginx php5 thinkphp_3…

试读—增长黑客,创业公司必知的“黑科技”

概述 刚一看到书名,最引起注意的是黑客两个字,那个带着神秘色彩,让无数程序员羡慕嫉妒恨的角色。但仔细一看,增长黑客,创业公司必知的“黑科技”,是讲公司如何以切实的依据、低廉的成本、可控的风险来达成用…

java.sql.sqlexception: value '0000-00-00 00:00:00' can not be represented as java.sql.timestamp

详细错误信息: org.springframework.dao.transientdataaccessresourceexception: ### error querying database. cause: java.sql.sqlexception: value 0000-00-00 00:00:00 can not be represented as java.sql.timestamp ### the error may exist in url [jar:…

java.lang.numberformatexception: for input string: undefined

在将字符串转换为数字时导致此错误,解决此问题的思路:1、添加try catch语句,2、判断字符串是否为数字,将介绍java中判断字符串是否为数字的方法的几种方法。 完整错误信息: java.lang.numberformatexception: for inp…

ruby rails入门——windows下搭建ruby rails web开发环境

ruby on rails 是一个可以使你开发,部署,维护 web 应用程序变得简单的框架。2015年10月编程语言排行榜 ruby进入tiobe排行榜前十,可见其流行程度如此之高。本文就帮你打开ruby on rails web开发的大门,助你进入ruby on rails的世界,感受不一样的风景。 ruby on rails完整…

could not find gem 'sqlite3 (= 0) x64-mingw32' in any of the gem sources listed in your gemfile

could not find gem sqlite3 (>= 0) x64-mingw32 in any of the gem sources listed in your gemfile or available on this machine. run `bundle install` to install missing gems. 在 windows下搭建ruby rails web开发环境 时遇到这个问题, 出现此问题的原因是:没…

could not find gem 'sass-rails (~ 5.0) x64-mingw32' in any of the gem sources listed in your gemfil

could not find gem sass-rails (~> 5.0) x64-mingw32 in any of the gem sources listed in your gemfile or available on this machine. run bundle install to install missing gems. 在 windows下搭建ruby rails web开发环境 时遇到这个问题, 出现此问题的…

windows 7 x64环境下jdk8安装过程

windows 7 x64环境下jdk8安装过程 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 最好是不要使用默认的目录,通常默认的目录都带有空格,可能会引起不必要的麻烦;
网站地图