sring整合mybatis报错:Invalid bound statement (not found):

最近没写ssm项目了,自己重新搭建项目在spring整合mybatis的时候,报错如下信息,忘记怎么解决了


org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.java.mapper.UserMapping.getUserById

	at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:189)
	at org.apache.ibatis.binding.MapperMethod.(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.getUserById(Unknown Source)
	at com.java.test.test(test.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
	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)

原因:

检查了好久,所有的namespace ,等配置都没有问题,后来找了半天,发现在编译之后的xml文件没有被加载;在编译之后的target文件夹中没有对应的xml文件,所以导致的
sring整合mybatis报错:Invalid bound statement (not found):_第1张图片

解决方案:

找到pom文件,添加下面代码

		
            
                src/main/java
                
                    **/*.xml
                
            
        

sring整合mybatis报错:Invalid bound statement (not found):_第2张图片

再看下编译之后的target文件夹

sring整合mybatis报错:Invalid bound statement (not found):_第3张图片

你可能感兴趣的:(mybatis)