springcloud配置nacos启动报错

本文分析了SpringCloud应用在配置Nacos时遇到的启动错误,包括配置中心和服务发现的问题。错误提示表明无法从配置文件获取Nacos服务信息。解决方案在于正确配置application.yml和bootstrap.properties,确保服务发现和配置中心的设置完整。文中还提供了完整的配置示例,并提醒开发者注意避免自学过程中的瓶颈。
摘要由CSDN通过智能技术生成

报错1:

2022-06-09 22:07:27.934 ERROR 15656 --- [           main] c.a.cloud.nacos.NacosConfigProperties    : create config service error!properties=NacosConfigProperties{serverAddr='null', encode='null', group='DEFAULT_GROUP', prefix='null', fileExtension='properties', timeout=3000, endpoint='null', namespace='null', accessKey='null', secretKey='null', contextPath='null', clusterName='null', name='null', sharedDataids='null', refreshableDataids='null', extConfig=null},e=,

com.alibaba.nacos.api.exception.NacosException: java.lang.reflect.InvocationTargetException
	at com.alibaba.nacos.api.config.ConfigFactory.createConfigService(ConfigFactory.java:45) ~[nacos-api-1.1.1.jar:na]
	at com.alibaba.nacos.api.NacosFactory.createConfigService(NacosFactory.java:43) ~[nacos-api-1.1.1.jar:na]
	at com.alibaba.cloud.nacos.NacosConfigProperties.configServiceInstance(NacosConfigProperties.java:346) ~[spring-cloud-alibaba-nacos-config-2.1.0.RELEASE.jar:2.1.0.RELEASE]
	at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.locate(NacosPropertySourceLocator.java:63) [spring-cloud-alibaba-nacos-config-2.1.0.RELEASE.jar:2.1.0.RELEASE]
	at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:51) [spring-cloud-context-3.1.3-20220527.135538-64.jar:3.1.3-SNAPSHOT]
	at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:47) [spring-cloud-context-3.1.3-20220527.135538-64.jar:3.1.3-SNAPSHOT]
	at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:95) [spring-cloud-context-3.1.3-20220527.135538-64.jar:3.1.3-SNAPSHOT]
	at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:607) [spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:373) [spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) [spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) [spring-boot-2.7.0.jar:2.7.0]
	at com.aimer.aimermall.member.AimermallMemberApplication.main(AimermallMemberApplication.java:11) [classes/:na]
Caused by: java.lang.reflect.InvocationTargetException: null
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_202]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstru
根据提供的引用内容,nacos启动报错org.springframework.beans.factory.BeanCreationException很可能是由于spring-boot-starter-parent的版本与spring-cloud-starter-alibaba-nacos-config的版本不兼容所致。在引用中,作者最初的版本中spring-boot-starter-parent的版本为2.5.4,而spring-cloud-starter-alibaba-nacos-config的版本为2.2.6.RELEASE。但是在引用中,作者将spring-boot-starter-parent的版本改为了2.2.6.RELEASE,问题得到了解决。 此外,在引用中,作者提到了关于bean注入失败和循环依赖的问题,经过查询和尝试,作者最终选择了下载一个安装包并配置了相关数据库,从而解决了问题。 因此,如果遇到nacos启动报错org.springframework.beans.factory.BeanCreationException的问题,可以尝试检查spring-boot-starter-parent和spring-cloud-starter-alibaba-nacos-config的版本兼容性,或者考虑通过下载安装包并配置相关数据库来解决问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [springboot引入nacos报错:org.springframework.beans.factory.BeanCreationException: Error creating ...](https://blog.csdn.net/weixin_44960120/article/details/120337517)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [Pig项目学习一,启动Nacos 出错问题](https://blog.csdn.net/qrn196789910/article/details/109945853)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值