org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.hnust.dao.UserDao.queryPreciseUsers org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:943) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:833) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
root cause
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.hnust.dao.UserDao.queryPreciseUsers org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:178) org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:38) org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:49) org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:42) $Proxy31.queryPreciseUsers(Unknown Source) com.hnust.service.impl.UserServiceImpl.queryPreciseUsers(UserServiceImpl.java:51) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201) $Proxy32.queryPreciseUsers(Unknown Source) com.hnust.controller.LoginController.login(LoginController.java:55) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:175) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:931) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:833) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
root cause
org.apache.ibatis.builder.IncompleteElementException: Could not find SQL statement to include with refid 'com.hnust.dao.RestaurantDao.userInfo' org.apache.ibatis.builder.xml.XMLIncludeTransformer.findSqlFragment(XMLIncludeTransformer.java:62) org.apache.ibatis.builder.xml.XMLIncludeTransformer.applyIncludes(XMLIncludeTransformer.java:37) org.apache.ibatis.builder.xml.XMLIncludeTransformer.applyIncludes(XMLIncludeTransformer.java:50) org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:85) org.apache.ibatis.session.Configuration.buildAllStatements(Configuration.java:675) org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:601) org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:596) org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:176) org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:38) org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:49) org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:42) $Proxy31.queryPreciseUsers(Unknown Source) com.hnust.service.impl.UserServiceImpl.queryPreciseUsers(UserServiceImpl.java:51) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201) $Proxy32.queryPreciseUsers(Unknown Source) com.hnust.controller.LoginController.login(LoginController.java:55) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:175) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:931) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:833) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
root cause
java.lang.IllegalArgumentException: XML fragments parsed from previous mappers does not contain value for com.hnust.dao.RestaurantDao.userInfo org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:768) org.apache.ibatis.builder.xml.XMLIncludeTransformer.findSqlFragment(XMLIncludeTransformer.java:58) org.apache.ibatis.builder.xml.XMLIncludeTransformer.applyIncludes(XMLIncludeTransformer.java:37) org.apache.ibatis.builder.xml.XMLIncludeTransformer.applyIncludes(XMLIncludeTransformer.java:50) org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:85) org.apache.ibatis.session.Configuration.buildAllStatements(Configuration.java:675) org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:601) org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:596) org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:176) org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:38) org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:49) org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:42) $Proxy31.queryPreciseUsers(Unknown Source) com.hnust.service.impl.UserServiceImpl.queryPreciseUsers(UserServiceImpl.java:51) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201) $Proxy32.queryPreciseUsers(Unknown Source) com.hnust.controller.LoginController.login(LoginController.java:55) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:175) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:931) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:833) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
注意:大多数人可能会觉得这就是mybatis的bug什么的,或者直接去找你调用那个类的mapper,实际上还有原因就是
1)对于特殊字符没有使用 <![CDATA[and deliveryMax < #{deliveryMax,jdbcType=NUMERIC},]]>
2) 虽然没有调用其他的mapper,但是mybatis加载的时候会同时加载其他类的mapper,所以可能是其他mapper造成的!我的原因就是这个