当前位置:网站首页>Startup error: Caused by: org.apache.ibatis.binding.BindingException summary solution
Startup error: Caused by: org.apache.ibatis.binding.BindingException summary solution
2022-08-09 16:03:00 【Students from three provinces】
报错
Springboot启动时从nacos拉取配置.启动报错:
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
报错分析
Usually there is an errorCaused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found),There are following reasons
1.mapper.xmlScan register
# mybatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.xx.xx
# 配置mapper的扫描,找到所有的mapper.xml映射文件
mapperLocations: classpath:mapper/**/*.xml
2.mapper接口与mapper.xml不在同一个包(package)The inconsistent or file name
3.mapper.xml的命名空间(namespace)与mapperThe package name of the interface does not agree
4. 接口的方法名,与xml中的sql标签的id不一致
5.接口中的返回值与xml方法配置esultMap或resultType不一致
通过,Screening for several possible situation,All are found the problem,由于是通过nacosPull configuration can be configured not pull to.
Take a closer look at startup information.
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
发现nacosTraining in rotation three configuration, did not get to,猜测正确
注:
拉取Nacos的配置文件时会轮训三个dataID:
格式一:name
文件名:xxx_config;
格式二:name.yaml
文件名+yaml后缀;格式三:name-master.yaml
文件名+profile + 后缀.中间用“-”分割.
解决
环境配置错误,Modify environment restart service success.
# Spring
spring:
application:
# 应用名称
name: test
profiles:
# 环境配置
active: dev
小结
If not change the code,启动报错,Check the configuration environment is correct or try to clear the cache, etc.

我与春风皆过客,你携秋水揽星河.
边栏推荐
- 测试工程师,看不上年薪20w,原因居然是...
- 6大论坛,30+技术干货议题,2022首届阿里巴巴开源开放周来了!
- 爬虫处理乱码问题
- ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions unless TOP, OFFSET, or FOR XML is also specified
- 第五讲 测试技术与用例设计
- FilenameFilter过滤文件名
- spacedesk-notebook, tablet, extended screen-solve the problem that the tablet font is too small
- 【基础版】整数加减乘除计算器
- Detailed firewall firewall
- 【LeetCode】1898. 可移除字符的最大数目
猜你喜欢

spacedesk-notebook, tablet, extended screen-solve the problem that the tablet font is too small

C语言程序设计笔记(浙大翁恺版) 第九周:指针

Swift中的Error处理

C语言程序设计笔记(浙大翁恺版) 第七章:函数

实践数据湖iceberg 第三十九课 清理快照前后数据文件变化分析

【NodeJs篇】关于path 路径模块的学习和使用

C语言程序设计笔记(浙大翁恺版) 第十一周:结构类型
![[Database] How does Sqlserver backup the database regularly and clear it regularly](/img/52/6a438adcb22943c1cfe0f26c25e706.png)
[Database] How does Sqlserver backup the database regularly and clear it regularly

JS——循环结构经典例题解析与分享

shell之函数和数组
随机推荐
概率论基础知识整理 | 概率论的基本概念
机器学习--数学库--概率统计
shell之函数和数组
08-Lock版的生产者消费者问题
【DevOps】jekins部署(一)
【Qt5 + OpenGL】glPointSize(10); error: undefined reference to `__imp_glPointSize‘
VMWare does not use easy install, install ISO manual manually
代码随想录笔记_动态规划_377组合总和IV
Hudi Spark-Shell 实战
Shell编程之循环语句
Docker安装MySQL详细步骤
【NodeJs篇】关于path 路径模块的学习和使用
Item 37: Make std::threads unjoinable on all paths.
概率论基础知识整理 | 随机变量的数字特征
【Qt】 No such slot...,No such signal
【基础版】整数加减乘除计算器
vivo手机上的系统级消息推送平台的架构设计实践
[LeetCode] 485.最大连续 1 的个数
玩转云端 | 天翼云电脑的百变玩法
ArcGIS在国土空间·城乡规划中的实战应用