问答详情
源自:-

junit测试时候遇到一个错误org.apache.ibatis.builder.IncompleteElementException: Could not find result map org.seckill.mapper.SeckillMapper.Seckill

org.apache.ibatis.builder.IncompleteElementException: Could not find result map org.seckill.mapper.SeckillMapper.Seckill

at org.apache.ibatis.builder.MapperBuilderAssistant.setStatementResultMap(MapperBuilderAssistant.java:354)

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

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

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

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

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

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

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

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

at com.sun.proxy.$Proxy11.queryById(Unknown Source)

at org.seckill.mapper.SeckillMapperTest.testReduceNumber(SeckillMapperTest.java:33)

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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

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

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

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

at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)

at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)

at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:229)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:86)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

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

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

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)

at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)

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

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:172)

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

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

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

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

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

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

Caused by: java.lang.IllegalArgumentException: Result Maps collection does not contain value for org.seckill.mapper.SeckillMapper.Seckill

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

at org.apache.ibatis.session.Configuration.getResultMap(Configuration.java:434)

at org.apache.ibatis.builder.MapperBuilderAssistant.setStatementResultMap(MapperBuilderAssistant.java:352)

... 38 more

请大家帮我看看,一直没找到解决方法

提问者:慕先生3717048 2016-08-25 00:06

个回答

  • 白非白
    2016-10-08 16:26:31

    看看你的mapper文件中是不是把resultMap和resultType搞混了。