[Mybatis] 绑定声明无效 Invalidbound statement (not found)

 

[Mybatis] 绑定声明无效 Invalidbound statement (not found)

 

这是页面报出来的错误:

HTTP Status 500 - Request processing failed; nested exception is
org.apache.ibatis.binding.BindingException:Invalid bound statement (not found): com.test.dao.UserMapper.getAllUser
   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.$Proxy13.add(Unknown Source)
   at com.coocaa.test.service.UserService.getUser(UserService.java:24)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   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)

经过查找,Spring-mybatis.xml中的配置也没有问题

 [Mybatis] 绑定声明无效 Invalidbound statement (not found)_第1张图片

 







然后在target目录下面发现没有mybatis目录的。 


这样就有两种解决方法了 


1.
将mybatis的xml文件全部放在resource下面 
再修改spring配置文件里面的路径 


2.需要在pom加一个resources的资源加载列表

<build>

     

     <resources>

         <resource>

       

              <directory>src/main/javadirectory>

              <includes>

                  <include>**/*.xmlinclude>

              includes>

         resource>

     resources>

  build>

 

这个时候,再次运行项目,就可以看到target目录下面存在mybatis的xml文件了 

这个错误只是我遇到的一种类型,可能解决不了左右的类型,敬请谅解

 

你可能感兴趣的:([Mybatis] 绑定声明无效 Invalidbound statement (not found))