报错
Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): xxx
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:227)
at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:49)
at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
at com.sun.proxy.$Proxy143.selectConfigList(Unknown Source)
at com.mmoa.system.service.impl.SysConfigServiceImpl.init(SysConfigServiceImpl.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157)
... 32 common frames omitted
报错分析
通常出现错误Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found),
都有如下原因
# mybatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.xx.xx
# 配置mapper的扫描,找到所有的mapper.xml映射文件
mapperLocations: classpath:mapper/**/*.xml
2.mapper接口与mapper.xml不在同一个包(package)下或文件名不一致
3.mapper.xml的命名空间(namespace)与mapper接口的包名不一致
5.接口中的返回值与xml方法配置esultMap或resultType不一致
通过,排查几种可能得到情况,均为发现问题,由于是通过nacos拉取配置有可能是配置未拉取到。
仔细查看启动信息。
15:43:15.030 [main] WARN c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[application-master.yml] & group[DEFAULT_GROUP]
15:43:15.037 [main] WARN c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[test] & group[DEFAULT_GROUP]
15:43:15.043 [main] WARN c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[test.yml] & group[DEFAULT_GROUP]
15:43:15.047 [main] WARN c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[test-master.yml] & group[DEFAULT_GROUP]
15:43:15.052 [main] INFO c.m.s.MmoaSystemApplication - [logStartupProfileInfo,674] - The following profiles are active: master
解决
# Spring
spring:
application:
# 应用名称
name: test
profiles:
# 环境配置
active: dev
小结
若未改动代码,启动报错,先检查配置环境是否正确或尝试清楚缓存等操作。
我与春风皆过客,你携秋水揽星河。
原文地址:https://blog.csdn.net/qq_35764295/article/details/126228812
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_28220.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。