【ide】MyBatis报错: org.apache.ibatis.binding…

2018-06-18 02:18:28来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

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.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)

    at com.sun.proxy.$Proxy3.getUserById(Unknown Source)

    at com.itheima.mybatis.MyBatisTest.getUserByIdTest(MyBatisTest.java:35)

    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:45)

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

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

    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.runners.ParentRunner.runLeaf(ParentRunner.java:263)

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

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

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

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

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

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

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

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

    at org.junit.runner.JUnitCore.run(JUnitCore.java:157)

    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)

    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)

    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)

    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

错误原因:

编译后的Mapper.xml文件和.class文件不在同一路径下.

解决:

在pom文件中添加:

<build>

<resources>

<resource>

<directory>${basedir}/src/main/java</directory>

<includes>

<include>**/*.xml</include>

</includes>

</resource>

</resources>

</build>

删除原target目录,添加后,重新运行编译

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:this关键字和super关键字

下一篇:Thinking in Java第七章学习笔记----复用类