nvalid bound statement (not found)解决方法
来源:互联网 发布:python做数据分析应用 编辑:程序博客网 时间:2024/06/03 12:43
错误描述,smm项目出现:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): org.seckill.dao.SeckillDao.queryById at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:189) at org.apache.ibatis.binding.MapperMethod.<init>(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.$Proxy15.queryById(Unknown Source) at org.test.Test1.queryById1(Test1.java:21) 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.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:232) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) 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.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:309) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:175) 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:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
这样的错误你先仔细检查namespace里的路径是否正确,我这里产生这样报错的原因是因为在配置文件中写的mapping路径是
<!-- 自动扫描mapping.xml文件 --> <property name="mapperLocations" value="classpath:*Dao.xml"></property>
改成
<!-- 自动扫描mapping.xml文件 --> <property name="mapperLocations" value="classpath*:*Dao.xml"></property>
就可以运行了,至于classpath:和classepath*:的区别简单说就是
classpath:只会到你的class路径中查找找文件;
classpath*:不仅包含class路径,还包括jar文件中(class路径)进行查找。
为了运行速度还是少尽量使用classpath*。
比如我在这里再建立一个文件夹叫mapper放置将映射文件放进去,再将路径改为
<property name="mapperLocations" value="classpath:/mapper/*Dao.xml"></property>
这样也是可以运行的。
想要具体了解区别原因的请看我转载的这篇博客。
阅读全文
0 0
- nvalid bound statement (not found)解决方法
- Maven项目mybatis Invalid bound statement (not found)解决方法
- Maven项目mybatis Invalid bound statement (not found)解决方法
- IDEA中 Invalid bound statement (not found)解决方法
- [MyBatis]Invalid bound statement (not found)错误解决方法总结
- Invalid bound statement (not found):
- Invalid bound statement (not found)
- Invalid bound statement (not found)
- Invalid bound statement (not found)
- Invalid bound statement (not found)
- Invalid bound statement (not found)
- Invalid bound statement (not found)
- Invalid bound statement (not found)
- Invalid bound statement (not found)
- Invalid bound statement (not found)
- Invalid bound statement (not found)
- invalid bound statement (not found)
- Invalid bound statement (not found)
- 深入理解JVM--class类文件结构
- 浅谈前端移动端页面开发(布局篇)
- JavaScript学习笔记(基本数据类型)
- Code Size
- 小程序访问本地服务器注意点
- nvalid bound statement (not found)解决方法
- 大数据相关
- C语言指针
- (Swift) iOS Apps with REST APIs(五) -- 整合REST API和表格视图
- Java类的设计模式综述
- 漫步最优化十四——凸函数与凹函数
- 浅谈对spring的理解
- acdream A
- live555搭建简易流媒体服务