org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 解决过程

原创
2017/03/24 10:58
阅读数 8.8K

报错内容如下:

Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.pkusoft.admin.mapper.SysUserMapper.getSysUserByLoginName
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:230)
	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48)
	at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
	at com.sun.proxy.$Proxy20.getSysUserByLoginName(Unknown Source)
	at com.xx.admin.service.impl.SysUserServiceImpl.getSysUserByLoginName(SysUserServiceImpl.java:29)
	at com.xx.admin.service.impl.SysUserServiceImpl$$FastClassBySpringCGLIB$$85e6dfdc.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656)
	at com.xx.admin.service.impl.SysUserServiceImpl$$EnhancerBySpringCGLIB$$c93c27a2.getSysUserByLoginName(<generated>)
	at com.xx.admin.controller.ShiroDbRealm.doGetAuthenticationInfo(ShiroDbRealm.java:42)
	at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:568)
	at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:180)
	at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:267)
	at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198)
	... 34 more

 

解决过程:

1、在MapperMethod230上查看,是抛出异常,找到前面的代码,

重新执行,发现直接跳过,ms为null。也就是未加载xml文件。

2、从mybatis文件中找到加载文件的入口,

org.mybatis.spring.SqlSessionFactoryBean

重新启动项目,发现这里始终未加载需要的xml文件,关键是不报错。也就是未找到对应的mapper.xml文件。在编译后的文件中查了一下,果然没有加载编译后的文件。

分析原因,

我的项目是maven项目,pom文件中配置的是仅加载resource下的xml文件,不加载src下的xml文件,修改xml文件的路径就好了。

打完收工。

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部