2 gooddaisss gooddaisss 于 2016.03.04 17:52 提问

mybatis+spring mvc整合出的错误! 10C

在myeclipse中的配置文件转到intellij用maven创建web项目就出现下面的异常。
UserMapper.xml中的方法和UserMapper.java中的一样。改用原生JDBC连接没问题,就是不知道是什么错,请大神帮忙解答。在myeclipse中都没问题的,改maven就不行了,纳闷了、

type Exception report

message Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.liu.demo.mapper.UserMapper.insertUser

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.liu.demo.mapper.UserMapper.insertUser
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:927)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:822)
javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
root cause

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.liu.demo.mapper.UserMapper.insertUser
org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:189)
org.apache.ibatis.binding.MapperMethod.(MapperMethod.java:43)
org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:58)
org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:51)
com.sun.proxy.$Proxy7.insertUser(Unknown Source)
com.liu.demo.service.impl.UserServiceImpl.regist(UserServiceImpl.java:25)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
com.sun.proxy.$Proxy8.regist(Unknown Source)
com.liu.demo.controller.UserController.look(UserController.java:22)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:746)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:687)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:915)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:822)
javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.53 logs.

4个回答

u010686163
u010686163   2016.03.04 19:59

我建议你截图,发图片,这样根本没办法看!

u010686163
u010686163   2016.03.04 20:02

java.lang.ClassNotFoundException: com.tsinghua.Login
从上面这句异常看是找不到类路径。
原因有这么几个:
1、如果你请求的url是一个servlet,检查web.xml中servlet的类路径是否正确,注意大小写;
2、如果你请求的url是一下struts action,检查一下struts配置文件中action的类路径是否正确,注意大小写;
3、如果上面两个办法还不能解决,则有可能是你的类没有被正确编译。在idea中clear一下工程,然后重启tomcat试试。

qq_20039385
qq_20039385   2016.03.05 13:43

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.liu.demo.mapper.UserMapper.insertUser
意思是说UserMapper.xml中没有定义这个insertUser方法。可能是这个文件没有载入到内存。

rui888
rui888   Ds   Rxr 2016.03.05 14:08

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.liu.demo.mapper.UserMapper.insertUser

没有绑定 insertUser

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!