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.MapperBuilderAssistant.setStatementParameterMap(MapperBuilderAssistant.java:326)

at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:290)

at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:110)

at org.apache.ibatis.session.Configuration.buildAllStatements(Configuration.java:567)

at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:493)

at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:488)

at org.apache.ibatis.binding.MapperMethod.setupCommandType(MapperMethod.java:236)

at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:71)

at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:39)

at $Proxy9.find(Unknown Source)

at com.boco.fsmsys.amuse.service.impl.AmuseItemServiceImpl.find(AmuseItemServiceImpl.java:31)

at com.boco.fsmsys.amuse.service.impl.AmuseItemServiceImpl$$FastClassByCGLIB$$f42525b0.invoke(<generated>)

at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)

at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689)

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.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)

at com.boco.fsmsys.amuse.service.impl.AmuseItemServiceImpl$$EnhancerByCGLIB$$b6a4972c.find(<generated>)

at com.boco.fsmsys.test.service.AmuseItemServiceTest.testFind(AmuseItemServiceTest.java:15)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)

at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)

at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)

at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)

at org.junit.runners.ParentRunner.run(ParentRunner.java:220)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)

at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Caused by: java.lang.IllegalArgumentException: Parameter Maps collection does not contain value for com.boco.fsmsys.amuse.dao.AmuseItemDao.amuseItem

at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:660)

at org.apache.ibatis.session.Configuration.getParameterMap(Configuration.java:442)

at org.apache.ibatis.builder.MapperBuilderAssistant.setStatementParameterMap(MapperBuilderAssistant.java:324)

... 45 more

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

  1. <select id="getClassByID" parameterMap="String" resultMap="classResultMap">

)。

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

时间: 2024-10-08 10:37:30

org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map的相关文章

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

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.

[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

MyBtais错误:org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.a

Cause: java.lang.ClassNotFoundException: Cannot find class: BaseResultMap at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455) at org.springframework.beans.factor

The error may exist in com/bjpowernode/dao/StudentDao.xml ### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderExcept

The error may exist in com/bjpowernode/dao/StudentDao.xml### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xm

解决报错: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

org.apache.ibatis.reflection.ReflectionException: There is no getter for property named &#39;parentId&#39; in &#39;class java.lang.String&#39;

Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'parentId' in 'class java.lang.String' at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:333) at org.apache.ibatis.reflection.Meta

通过maven test 报org.apache.ibatis.binding.BindingException: Invalid bound statement

背景 直接使用eclipse工具去执行,没有问题,通过testng.xml去执行,没有问题,但通过mvn clean test执行,就报错,提示org.apache.ibatis.binding.BindingException: Invalid bound statement 解决方法 首先先肯定的是:mybatis的配置是没有问题,因为eclipse可以正常执行: 在eclipse中把mapper的xml文件放到src代码目录下是可以一起打包进classes的,而maven去编译的时候不会,