Mybatis报错:org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.me.mybatis.mapper.OrderMapper.

运行关联查询的例子时报错:

org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.me.mybatis.mapper.OrderMapper.
 at org.apache.ibatis.builder.MapperBuilderAssistant.setStatementResultMap(MapperBuilderAssistant.java:346)
 at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:284)
 at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:107)
 at org.apache.ibatis.session.Configuration.buildAllStatements(Configuration.java:698)
 at org.apache.ibatis.session.Configuration.hasStatement(Configuration.java:668)
 at org.apache.ibatis.session.Configuration.hasStatement(Configuration.java:663)
 at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:180)
 at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:43)
 at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:58)
 at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:51)
 at com.sun.proxy.$Proxy10.selectOrders(Unknown Source)
 at com.me.mybatis.junit.MybatisMapperTest.testOrderList(MybatisMapperTest.java:187)
 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.base/java.lang.reflect.Method.invoke(Method.java:567)
 at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:628)
 at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:117)
 at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:184)
 at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
 at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:180)
 at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:127)
 at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
 at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
 at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
 at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
 at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
 at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
 at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
 at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
 at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
 at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
 at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
 at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
 at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
 at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
 at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
 at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
 at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
 at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
 at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
 at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
 at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
 at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:137)
 at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:89)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Caused by: java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.me.mybatis.mapper.OrderMapper.
 at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:797)
 at org.apache.ibatis.session.Configuration.getResultMap(Configuration.java:550)
 at org.apache.ibatis.builder.MapperBuilderAssistant.setStatementResultMap(MapperBuilderAssistant.java:344)
 ... 64 more

分析原因:找不到resultmap,然后打开对应的xml文件,发现

两个不一样。因此只需要把resultmap和id的内容一致就可以了。

原文地址:https://www.cnblogs.com/tkg1314/p/12286428.html

时间: 2024-10-08 10:36:11

Mybatis报错:org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.me.mybatis.mapper.OrderMapper.的相关文章

org.apache.ibatis.builder.IncompleteElementException: Could not find result map java.util.HashMap

这样的配置有问题吗? <select id="getFreightCollectManagementList" resultMap="java.util.HashMap" parameterType="com.rms.providers.dto.AccountingPayableDto"> 有的, 出现mybatis 错误: 2018-08-13 15:28:35 -13867 [http-nio-80-exec-10] DEBUG

org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map

同事让我帮他找一个错误,他说明明写的对的,怎么老是报错.其实,使用MyBaties在编写sql配置文件时,都会遇到的一个小问题,问题虽小,对初学者可能都会碰到. org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map com.boco.fsmsys.amuse.dao.AmuseItemDao.amuseItem at org.apache.ibatis.builder.MapperBu

Maven项目使用mybatis报错 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

maven项目使用mybatis时,找不到mapper文件(.xml) 错误信息提示: 项目可以正常运行,但是在有请求到达服务器时(有访问数据库的请求),会出现报错!! 错误原因: mybatis没有找到对应的请求调用持久层的方法 查错方法: 首先检查target-->classes文件夹被dao层文件夹内是否有对应mapper.xml文件,如果有xml文件,则一般是配置文件出现的错误,如果没有xml类型的文件,则是没有拷贝资源文件的原因.下面是对应的解决方法. 1.名称不一致问题 排查步骤:

【ide】MyBatis报错: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:225) at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48) at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65) at org.a

[springMVC - 1A] - Request processing failed; nested exception is org.apache.ibatis.builder.IncompleteElementException

一月 14, 2016 1:30:07 下午 org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet.service() for servlet [springMVC] in context with path [/ExceptionManageSystem] threw exception [Request processing failed; nested exception is org.apache.ibatis.b

Mybatis报错:org.apache.ibatis.builder.IncompleteElementException

org.apache.ibatis.builder.IncompleteElementException: Could not find result map java.lang.Integer遇到这种问题,一般都是因为在xml中基本类型返回属性的属性名写成了resultMap.由于Mybatis的报错的定位文件有时候不准,所以不要只看错误信息中提到的文件关联的文件,所以ctrl+alt+h 全工程内检索(可能你的全文检索不是这个快捷键),resultMap="java.lang.Integer

Mybatis缓存报错org.apache.ibatis.exceptions.PersistenceException

错误信息如下: org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.apache.ibatis.cache.CacheException: Error deserializing object. Cause: java.lang.ClassNotFoundException: com.kytsoft.model.Adminlink ### Cause: org.apa

报错org.apache.ibatis.binding.BindingException: Type interface com.atguigu.mybatis.bean.dao.EmployeeMapper is not known to the MapperRegistry.

我报这个错误的原因是因为mybatis-config.xml配置文件中 <!-- 批量注册: --> <package name="com.atguigu.mybatis.dao"/> 没有写对,根据路径改正就可以了.比如说应该写成 <package name="com.atguigu.mybatis.dao"/> 结果我写成了 <package name="com.atguigu.mybatis.bean.dao

解决报错:IncompleteElementException: Could not find result map...

今天遇到这样一个报错,记录一下: org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.xxx.manager.mapper.ItemMapper.Item at org.apache.ibatis.builder.MapperBuilderAssistant.getStatementResultMaps(MapperBuilderAssistant.java:346) at org