org.apache.ibatis.builder.xml.IncompleteStatementException: Could not find result map java.util.Map

狄高畅
2023-12-01

ibatis中sql配置文件返回值类型错误.

10:33:32.278 ERROR c.i.c.a.controller.IpTableController - Exception: 
org.apache.ibatis.builder.xml.IncompleteStatementException: Could not find result map java.util.Map
    at org.apache.ibatis.builder.MapperBuilderAssistant.setStatementResultMap(MapperBuilderAssistant.java:290) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:228) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:66) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.session.Configuration.buildAllStatements(Configuration.java:504) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:435) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:430) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.binding.MapperMethod.setupCommandType(MapperMethod.java:188) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:51) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:24) ~[mybatis-3.0.6.jar:3.0.6]
    at com.sun.proxy.$Proxy79.selectByExample(Unknown Source) ~[na:na]
    at com.itumpsub.component.perfMonitor.service.impl.PerfMonitorServiceImpl.selectByExample(PerfMonitorServiceImpl.java:48) ~[PerfMonitorServiceImpl.class:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_25]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_25]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_25]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_25]
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at com.sun.proxy.$Proxy80.selectByExample(Unknown Source) ~[na:na]
    at com.itumpsub.component.perfMonitor.controller.PerfMonitorController.selectAllUrl(PerfMonitorController.java:173) ~[PerfMonitorController.class:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_25]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_25]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_25]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_25]
    at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:212) ~[spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126) ~[spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) ~[servlet-api.jar:na]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) ~[servlet-api.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) ~[catalina.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[catalina.jar:na]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) ~[spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) ~[spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) ~[catalina.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[catalina.jar:na]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) ~[catalina.jar:na]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) ~[catalina.jar:na]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) ~[catalina.jar:na]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) ~[catalina.jar:na]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) ~[catalina.jar:na]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) ~[catalina.jar:na]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) ~[tomcat-coyote.jar:na]
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) ~[tomcat-coyote.jar:na]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) ~[tomcat-coyote.jar:na]
    at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]
Caused by: java.lang.IllegalArgumentException: Result Maps collection does not contain value for java.util.Map
    at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:595) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.session.Configuration.getResultMap(Configuration.java:364) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.builder.MapperBuilderAssistant.setStatementResultMap(MapperBuilderAssistant.java:288) ~[mybatis-3.0.6.jar:3.0.6]
    ... 50 common frames omitted
10:33:32.395 ERROR c.i.c.a.controller.IpTableController - Exception: 
org.apache.ibatis.builder.xml.IncompleteStatementException: Could not find result map java.util.Map
    at org.apache.ibatis.builder.MapperBuilderAssistant.setStatementResultMap(MapperBuilderAssistant.java:290) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:228) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:66) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.session.Configuration.buildAllStatements(Configuration.java:504) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:435) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:430) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.binding.MapperMethod.setupCommandType(MapperMethod.java:188) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:51) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:24) ~[mybatis-3.0.6.jar:3.0.6]
    at com.sun.proxy.$Proxy47.selectAlertsStatusByUsername(Unknown Source) ~[na:na]
    at com.itumpsub.component.perfMonitor.service.impl.AlertConfServiceImpl.selectAlertsStatusByUsername(AlertConfServiceImpl.java:95) ~[AlertConfServiceImpl.class:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_25]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_25]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_25]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_25]
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at com.sun.proxy.$Proxy48.selectAlertsStatusByUsername(Unknown Source) ~[na:na]
    at com.itumpsub.component.perfMonitor.controller.AlertConfController.selectAlertsStatusByUsername(AlertConfController.java:322) ~[AlertConfController.class:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_25]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_25]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_25]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_25]
    at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:212) ~[spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126) ~[spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) ~[servlet-api.jar:na]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) ~[servlet-api.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) ~[catalina.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[catalina.jar:na]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) ~[spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) ~[spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) ~[catalina.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[catalina.jar:na]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) ~[catalina.jar:na]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) ~[catalina.jar:na]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) ~[catalina.jar:na]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) ~[catalina.jar:na]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) ~[catalina.jar:na]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) ~[catalina.jar:na]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) ~[tomcat-coyote.jar:na]
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) ~[tomcat-coyote.jar:na]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) ~[tomcat-coyote.jar:na]
    at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]
Caused by: java.lang.IllegalArgumentException: Result Maps collection does not contain value for java.util.Map
    at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:595) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.session.Configuration.getResultMap(Configuration.java:364) ~[mybatis-3.0.6.jar:3.0.6]
    at org.apache.ibatis.builder.MapperBuilderAssistant.setStatementResultMap(MapperBuilderAssistant.java:288) ~[mybatis-3.0.6.jar:3.0.6]
    ... 50 common frames omitted

从异常的提示可以知道是xml配置文件中,sql语句返回值类型或者名称写错了,但是你发现这个位置并没有些写错。于是你很困惑,其实问题就在这个配置文件中,提示的也对,只是位置不对。mybaties中只要有任何一个地方报错,都无法通过。最后发现是另个一个方法上将resultType写成了resultMap了(

)。

再者之所以大家犯错,有一个原因是在编写配置文件时,会提示resultMap,但是这个在mybaties中已经不再用这个属性了。所以大家写配置文件时,要小心细心。

 类似资料:

相关阅读

相关文章

相关问答