XML fragments parsed from previous mappers does not

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 &lt; #{deliveryMax,jdbcType=NUMERIC},]]>
2) 虽然没有调用其他的mapper,但是mybatis加载的时候会同时加载其他类的mapper,所以可能是其他mapper造成的!我的原因就是这个

相关文章

引言 NOKIA 有句著名的广告语:“科技以人为本”。任何技术都是为了满足人的生产生活需要而产生的。具体...
Writer:BYSocket(泥沙砖瓦浆木匠) 微博:BYSocket 豆瓣:BYSocket Reprint it anywhere u want. 文章...
Writer:BYSocket(泥沙砖瓦浆木匠) 微博:BYSocket 豆瓣:BYSocket Reprint it anywhere u want. 文章...
http://blog.jobbole.com/79252/ 引言 NOKIA 有句著名的广告语:“科技以人为本”。任何技术都是为了满...
(点击上方公众号,可快速关注) 公众号:smart_android 作者:耿广龙|loonggg 点击“阅读原文”,可查看...
一、xml与xslt 相信所有人对xml都不陌生,其被广泛的应用于数据数据传输、保存与序列化中,是一种极为强...