mybaties 错误[通俗易懂]

2022-11-16 18:15:29 浏览数 (1)

先看下错误

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.sinofaith.idaplus.goodsitem.mapping.GoodslowInfoPOMapper.selectByPrimaryKey at org.apache.ibatis.binding.MapperMethodSqlCommand.<init>(MapperMethod.java:189) at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:43) at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:58) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:51) at com.sun.proxy.1.proceedWithInvocation(TransactionInterceptor.java:96) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.Proxy14.getListByBrandPlatformAndDate(Unknown Source) at com.sinofaith.idaplus.notice.mail.impl.LowPriceResultMailSendImpl.getGoodsLowPriceInfo(LowPriceResultMailSendImpl.java:209) at com.sinofaith.idaplus.notice.mail.impl.LowPriceResultMailSendImpl.sendMail(LowPriceResultMailSendImpl.java:191) at com.sinofaith.idaplus.notice.mail.impl.LowPriceResultMailSendImpl.autoSendMail(LowPriceResultMailSendImpl.java:135) at com.sinofaith.idaplus.notice.mail.impl.LowPriceResultMailSendImpl.sendMsg(LowPriceResultMailSendImpl.java:83) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269) at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBeanMethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:311) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPoolWorkerThread.run(SimpleThreadPool.java:573)

解决这个问题还是有点麻烦的 刚开始是认为是xml包结构和接口包结构不一致所致 试了很久没成功

然后看到了一篇写的蛮好的博客

https://my.oschina.net/psuyun/blog/464851

然后看了下原项目的配置

代码语言:javascript复制
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="configLocation" value="classpath:/config/mybatis-config.xml" />
    <!-- 映射文件集合 -->
    <!--<property name="mapperLocations" value="classpath:/com.sinofaith.idaplus.*/*.xml" />-->
    <property name="mapperLocations" value="classpath*:/mapper.*/*.xml" />
    <property name="dataSource" ref="dataSource" />
</bean>

Jetbrains全家桶1年46,售后保障稳定

然后发现 原本系统设置的包文件路径mapper下面所有的包

可是为了保证xml路径和接口路径一直 我压根不是这样设置的

问题随解决

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/234556.html原文链接:https://javaforall.cn

0 人点赞