org.apache.ibatis.binding.BingdingException:Invalid bound statement(not found):com.ty.mapper........

原因是maven打包的时候,没有把XXXmapper.xml 文件编译过来

解决办法:在maven项目的pom.xml添加:

<resources>
	<resource>
	      <directory>src/main/java</directory>
		<includes>
		   <include>**/*.xml</include>
                   <include>**/*.properties</include>
              </includes>
	</resource>
	<!-- <resource>
	    <directory>src/main/resources</directory>
	    <includes>
		<include>**/*.xml</include>
	    </includes>
	</resource> -->
</resources

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

01-07

问题如下:rn[org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] - Resolving exception from handler [public java.lang.String com.cn.hnust.controller.UserController.toIndex(java.lang.String,java.lang.String,org.springframework.ui.Model)]: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.cn.hnust.dao.UserMapper.insertSelectivern[org.springframework.web.servlet.DispatcherServlet] - Could not complete requestrnorg.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.cn.hnust.dao.UserMapper.insertSelectivern at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:189)rn at org.apache.ibatis.binding.MapperMethod.(MapperMethod.java:43)rn at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:58)rn at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:51)rn at com.sun.proxy.$Proxy16.insertSelective(Unknown Source)rn at com.cn.hnust.service.impl.UserServiceImpl.insertUser(UserServiceImpl.java:25)rn at com.cn.hnust.controller.UserController.toIndex(UserController.java:34)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:497)rn at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)rn at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)rn at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)rn at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)rn at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:690)rn at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)rn at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)rn at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)rn at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)rn at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)rn at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)rn at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)rn at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)rn at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)rn at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)rn at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn at java.lang.Thread.run(Thread.java:745)rn__________________________________________________________________________________________________rnrn利用mybatis-generator-core-1.3.2自动生成UserMapper,UserMapper.xml,User文件rnrn源码这里粘贴长度不允许,传至github,maven下的工程结构很简单,希望各位大大能够帮忙看一下,弄了很久一直没弄好spring-mybatis的一个问题。rnhttps://github.com/Bonsen/Spring-SpringMVC-mybatis

关于mybatis Invalid bound statement (not found) 问题

06-26

初学mybatis 现在系统是spring + mybatis rnapplicationContext.xml里面配置了Mapper 自动扫描rnrnrn rnrnrn然后定义了一个userMapper,里面就只有一个方法rnrn@Repository(value="userMapper")rnpublic interface UserMapper rn public List getAll();rnrnrn下面是userMapper.xmlrnrn rn select * from userrn rnrnrn下面是mybatis 配置文件rnrnrn rn rn rn rn rn rn rn rn rnrnrn我业务层定义了一个接口 UserService 然后 下面是实现类rnrn@Component(value="userServiceImpl")rn@Transactionalrnpublic class UserServiceImpl implements UserServicern rn private UserMapper userMapper;rn @Autowiredrn public void setUserMapper(UserMapper userMapper) rn this.userMapper = userMapper;rn rnrn public List getAll() rn return userMapper.getAll();rn rnrnrnrn我spring 配置文件加载完成后运行下面的代码可以获取结果rnUserServiceImpl userServiceImpl = (UserServiceImpl)PlatformContext.getApplicationContext().getBean("userServiceImpl");rnList lista = userServiceImpl.getAll();rnrn但是我现在又写了一个类 叫UserComponent 如下:rn@Component(value="userComponent")rnpublic class UserComponent rn private UserService userService;rn @Autowiredrn public void setUserService(UserService userService) rn this.userService = userService;rn rn public List getAll(Head head)rn return userService.getAll();rn rnrnrn我这个UserService直接注入了rnUserComponent userComponent = (UserComponent)PlatformContext.getApplicationContext().getBean("userComponent");rnList list = userComponent.getAll();rnrn我像这样调用的时候就不行了,只是多加了一层啊,这是为啥,求解!rnrn[b]下面是异常信息:[/b]rn[b]org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.yolly.platform.user.service.UserService.getAll[/b]rn at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:178)rn at org.apache.ibatis.binding.MapperMethod.(MapperMethod.java:38)rn at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:49)rn at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:42)rn at $Proxy12.getAll(Unknown Source)rn at com.yolly.platform.user.component.UserComponent.getAll(UserComponent.java:25)rn at com.yolly.core.main.Server$ServerHandler.messageReceived(Server.java:101)rn at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:690)rn at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417)rn at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47)rn at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765)rn at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:74)rn at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63)rn at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTask(OrderedThreadPoolExecutor.java:769)rn at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTasks(OrderedThreadPoolExecutor.java:761)rn at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.run(OrderedThreadPoolExecutor.java:703)rn at java.lang.Thread.run(Thread.java:662)rn[b]Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.yolly.platform.user.service.UserService.getAll[/b]rn at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:775)rn at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:615)rn at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:608)rn at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:176)rn ... 16 morernrnrnrnrnrnrn

mybatis+spring-boot出现Invalid bound statement (not found):问题

04-29

初学mybatis+spring-boot整合,报错如下:rn[code=java]org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.nx.zhjf.mapper.UserMapper.findUserByUsernamern [/code]rn我的代码结构如下:rn[img=http://img.bbs.csdn.net/upload/201704/29/1493469852_659574.png][/img][img=http://img.bbs.csdn.net/upload/201704/29/1493469861_915777.png][/img]rnapplication.ym配置文件如下:[code=java]rnspring:rn datasource:rn driver-class-name:org.postgresql.Driverrn url:jdbc:postgresql://localhost:5432/nxrn username:postgresrn password:postgresrn# schema:classpath:import.sqlrn tomcat:rn max-active:30rn max-wait:1000rn max-idle:20rn remove-abandoned-timeout:180rnmybatis:rn config-location:classpath:mybatis-config.xmlrnrn[/code]rnrnUserMapper.xml如下:rn[code=html]rnrnrnrn rn insert into t_user(username,age) values(#userName,jdbcType=VARCHAR,#age,jdbcType=NUMERIC)rn rnrn rn select * from t_user where id = #id,jdbcType=NUMERICrn rnrn rn update t_user setrn username = #userName,jdbcType=VARCHAR ,rn age = #age,jdbcType=NUMERICrn where id = #id,jdbcType=NUMERICrn rnrn rn delete from t_user where id = #id,jdbcType=NUMERICrn rnrn rn rn select * from t_user where username LIKE #patternrn rnrn rn SELECT COUNT(*) FROM t_userrn rnrn rn select * from t_userrn rnrnrnrn[/code]rnUserMapper.java如下:rn[code=java]rn@Mapperrnpublic interface UserMapper rn int save(User user);rnrn User selectById(Integer id);rnrn int updateById(User user);rnrn int deleteById(Integer id);rnrn List findUserByUsername(String username);rnrn int count();rnrn List queryAll();rnrn[/code]rnrn请大神帮我看下,哪里出问题了。rnrnrnrn

mybatis错误:Invalid bound statement (not found)万分感谢!

12-15

0.问题说明:n我是一名菜鸟,最近使用spring-mvc ,spring,mybatis框架n这两天出现一个错误一直搞不定,心好累,恳请前辈帮帮忙n1. 异常n```n org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.misscandy.inter.UserMapper.findAllUsersn org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)n org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)n javax.servlet.http.HttpServlet.service(HttpServlet.java:647)n org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)n javax.servlet.http.HttpServlet.service(HttpServlet.java:728)n org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)n org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)n org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)n```nnn n n2.我的配置文件n n```n n n n n nn n n n n n n```n3.接口nUserMapper.javannn```n package com.misscandy.inter;nnimport java.util.Vector;nnimport com.misscandy.entity.User;nimport com.misscandy.mapper.Mapper;nnn@Mappernpublic interface UserMapper n void addUser(User user);n //void deleteUser(User user);n //void updateDept(User user);n User findUserByName(String userName);n Vector findAllUsers();n //List> findValue();n //List findValues();nnn```nn4.UserMapper.xmlnnn```n nn nnn n n n n n n n n n n nn n n select user_id,user_name,image_src,age,sex,type from users where user_name = #userNamen n nn n n select user_id,user_name,age,sex,type from usersn n nn n n insert into users n (user_name,password,sex,age,type)n valuesn (#userName,#password,#sex,#age,1)n n nnnnn```nnn

Spring+mybatis整合报异常Invalid bound statement (not found)

07-03

## 直接上图了,例子很简单,图虽多但每张图代码都很少,希望大神解救:rn![图片说明](https://img-ask.csdn.net/upload/201607/03/1467546343_985846.jpg)rn## 代码图---》rn![图片说明](https://img-ask.csdn.net/upload/201607/03/1467546370_366042.jpg)rn![图片说明](https://img-ask.csdn.net/upload/201607/03/1467546378_236264.jpg)rn![图片说明](https://img-ask.csdn.net/upload/201607/03/1467546386_793432.jpg)rn![图片说明](https://img-ask.csdn.net/upload/201607/03/1467546394_5749.jpg)rn![图片说明](https://img-ask.csdn.net/upload/201607/03/1467546406_874546.jpg)rn## 配置文件---》rn![图片说明](https://img-ask.csdn.net/upload/201607/03/1467546425_74927.jpg)rn## 测试报错---》rn![图片说明](https://img-ask.csdn.net/upload/201607/03/1467546443_193123.jpg)rn## 完整的异常信息如下:rnorg.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.cailikun.dao.IUserDao.queryonern at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:178)rn at org.apache.ibatis.binding.MapperMethod.(MapperMethod.java:38)rn at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:49)rn at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:42)rn at $Proxy11.queryone(Unknown Source)rn at com.cailikun.service.impl.UserServiceImpl.queryone(UserServiceImpl.java:21)rn at com.cailikun.test.TestMyBatis.test1(TestMyBatis.java:23)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:601)rn at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)rn at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)rn at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)rn at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)rn at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)rn at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)rn at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)rn at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)rn at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)rn at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)rn at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)rn at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)rn at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:236)rn at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)rnCaused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.cailikun.dao.IUserDao.queryonern at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:768)rn at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:603)rn at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:596)rn at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:176)rn ... 34 morernrnrnrn

SpringMVC +Mybatis 一个问题 Invalid bound statement (not found):

04-24

SpringMVC 和Mybatis 集成 出现了一个问题,搜索了半天也没有解决;rnrnrnConsole 输出的错误:rn严重: Servlet.service() for servlet spring threw exceptionrnorg.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.test.www.dao.MainEntityMapper.selectByPrimaryKeyrn at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:184)rn at org.apache.ibatis.binding.MapperMethod.(MapperMethod.java:38)rn at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:49)rn at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:42)rn at $Proxy12.selectByPrimaryKey(Unknown Source)rn at com.test.www.service.impl.MainEntityServiceImpl.selectByPrimaryKey(MainEntityServiceImpl.java:24)rn at com.test.www.controller.MyTestController.sayHello(MyTestController.java:24)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)rn at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)rn at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)rn at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)rn at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)rn at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)rn at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)rn at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)rn at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)rn at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)rn at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)rn at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864)rn at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)rn at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665)rn at java.lang.Thread.run(Thread.java:619)rnrn只跑SpringMVC是没有问题的,和 Mybatis 数据库结合就出问题了:rnrnSpring的 配置文件:ApplicationContext.xml 的内容:rnrn rn rn rn rn classpath:database.properties rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrnrn rnrn目录结构:rn[img=http://img.bbs.csdn.net/upload/201704/24/1493001264_147346.png][/img]rnrn不知道问题出在哪了,困扰了好几天了。

mybatis错误: Invalid bound statement (not found) 万分感谢!

12-15

0.问题说明:rn我是一名菜鸟,最近使用spring-mvc ,spring,mybatis框架rn这两天出现一个错误一直搞不定,心好累,恳请前辈帮帮忙rn1. 异常rn```rn org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.misscandy.inter.UserMapper.findAllUsersrn org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)rn org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:647)rn org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:728)rn org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)rn org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)rn org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)rn```rnrnrn rn rn2.我的配置文件rn rn```rn rn rn rn rn rnrn rn rn rn rn rn rn```rn3.接口rnUserMapper.javarnrnrn```rn package com.misscandy.inter;rnrnimport java.util.Vector;rnrnimport com.misscandy.entity.User;rnimport com.misscandy.mapper.Mapper;rnrnrn@Mapperrnpublic interface UserMapper rn void addUser(User user);rn //void deleteUser(User user);rn //void updateDept(User user);rn User findUserByName(String userName);rn Vector findAllUsers();rn //List> findValue();rn //List findValues();rnrnrn```rnrn4.UserMapper.xmlrnrnrn```rn rnrn rnrnrn rn rn rn rn rn rn rn rn rn rn rnrn rn rn select user_id,user_name,image_src,age,sex,type from users where user_name = #userNamern rn rnrn rn rn select user_id,user_name,age,sex,type from usersrn rn rnrn rn rn insert into users rn (user_name,password,sex,age,type)rn valuesrn (#userName,#password,#sex,#age,1)rn rn rnrnrnrnrn```rnrnrnrn

ssm整合,报错:org.apache.ibatis.binding.BindingException: Invalid bound statement

07-28

想要自己搭建一下ssm框架,运行就给报错,无从下手,求帮助:rn报错信息:[code=java]严重: Servlet.service() for servlet [SpringMVC] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): web.dao.WebkUserDao.selectByPrimaryKey] with root causernorg.apache.ibatis.binding.BindingException: Invalid bound statement (not found): web.dao.WebkUserDao.selectByPrimaryKeyrn at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:189)rn at org.apache.ibatis.binding.MapperMethod.(MapperMethod.java:43)rn at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:58)rn at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:51)rn at com.sun.proxy.$Proxy13.selectByPrimaryKey(Unknown Source)rn at web.service.WebkUserService.find(WebkUserService.java:18)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)rn at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)rn at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)rn at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)rn at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)rn at com.sun.proxy.$Proxy16.find(Unknown Source)rn at web.controller.IndexController.test(IndexController.java:58)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)rn at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)rn at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)rn at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)rn at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:690)rn at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)rn at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)rn at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)rn at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)rn at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)rn at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)rn at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)rn at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082)rn at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)rn at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)rn at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn at java.lang.Thread.run(Thread.java:745)rnrn七月 28, 2016 11:09:00 上午 org.apache.catalina.core.ApplicationContext logrn信息: Destroying Spring FrameworkServlet 'SpringMVC'rn七月 28, 2016 11:09:00 上午 org.apache.catalina.core.ApplicationContext logrn信息: Closing Spring root WebApplicationContext[/code]rnrn配置文件如下:rnapplicationContext-dao.xmlrn[code=java]rn rnrn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn [/code]rnapplicationContext-service.xmlrn[code=java][/code]rnapplicationContext-transaction.xmlrn[code=java]rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn [/code]rnspringmvc.xmlrn[code=java]rn rnrn rn rn rn rnrn rn rn rn rn rn [/code]rn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试

关闭