springboot集成nacos报错:get data from Nacos error,dataId:null.yaml的原因及解决方法
控制台打印错误
2023-10-14 20:43:38.747 ERROR 10024 --- [ main] c.a.c.n.c.NacosPropertySourceBuilder : get data from Nacos error,dataId:null.yaml com.alibaba.nacos.api.exception.NacosException: <html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Sat Oct 14 20:43:38 CST 2023</div><div>There was an unexpected error (type=Forbidden, status=403).</div><div>user not found!</div></body></html> at com.alibaba.nacos.client.config.impl.ClientWorker.getServerConfig(ClientWorker.java:239) ~[nacos-client-1.4.2.jar:na] at com.alibaba.nacos.client.config.NacosConfigService.getConfigInner(NacosConfigService.java:160) ~[nacos-client-1.4.2.jar:na] at com.alibaba.nacos.client.config.NacosConfigService.getConfig(NacosConfigService.java:100) ~[nacos-client-1.4.2.jar:na] at com.alibaba.cloud.nacos.client.NacosPropertySourceBuilder.loadNacosData(NacosPropertySourceBuilder.java:85) [spring-cloud-starter-alibaba-nacos-config-2.2.6.RELEASE.jar:2.2.6.RELEASE] at com.alibaba.cloud.nacos.client.NacosPropertySourceBuilder.build(NacosPropertySourceBuilder.java:73) [spring-cloud-starter-alibaba-nacos-config-2.2.6.RELEASE.jar:2.2.6.RELEASE] at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosPropertySource(NacosPropertySourceLocator.java:199) [spring-cloud-starter-alibaba-nacos-config-2.2.6.RELEASE.jar:2.2.6.RELEASE] at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosDataIfPresent(NacosPropertySourceLocator.java:186) [spring-cloud-starter-alibaba-nacos-config-2.2.6.RELEASE.jar:2.2.6.RELEASE] at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadApplicationConfiguration(NacosPropertySourceLocator.java:144) [spring-cloud-starter-alibaba-nacos-config-2.2.6.RELEASE.jar:2.2.6.RELEASE] at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.locate(NacosPropertySourceLocator.java:103) [spring-cloud-starter-alibaba-nacos-config-2.2.6.RELEASE.jar:2.2.6.RELEASE] at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:52) [spring-cloud-context-2.2.6.RELEASE.jar:2.2.6.RELEASE] at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:47) [spring-cloud-context-2.2.6.RELEASE.jar:2.2.6.RELEASE] at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:98) [spring-cloud-context-2.2.6.RELEASE.jar:2.2.6.RELEASE] at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:626) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE] at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:370) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE] at com.lyy.demo3.Demo3Application.main(Demo3Application.java:10) [classes/:na]
错误原因
是由于nacos开启了权限控制后,bootstrap.yml中没有配置用户名密码或者用户名密码出错,或者配置了的用户名没有该namespace的权限。
解决方法
方法一
关闭权限认证(不推荐,安全系数极低)
方法二
配置拥有该namespace权限并且正确的用户名密码
到此这篇关于springboot集成nacos报错:get data from Nacos error,dataId:null.yaml的原因及解决方法的文章就介绍到这了,更多相关springboot集成nacos报错内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
相关文章
在springboot中拦截器Filter中注入bean失败问题及解决
这篇文章主要介绍了在springboot中拦截器Filter中注入bean失败问题及解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教2024-05-05
Java中的ScheduledThreadPoolExecutor定时任务详解
这篇文章主要介绍了Java中的ScheduledThreadPoolExecutor详解, ScheduledThreadPoolExecutor 继承自 ThreadPoolExecutor,它主要用来在给定的延迟之后运行任务,或者定期执行任务,ScheduledThreadPoolExecutor 的功能与 Timer 类似<BR>,需要的朋友可以参考下2023-12-12
Java反射机制核心类Class、Constructor、Method、Field详解
反射机制是Java语言的一项强大特性,允许程序在运行时动态地加载、探知和使用类或者对象的信息,这篇文章主要介绍了Java反射机制核心类Class、Constructor、Method、Field的相关资料,需要的朋友可以参考下2025-12-12
gateway、webflux、reactor-netty请求日志输出方式
这篇文章主要介绍了gateway、webflux、reactor-netty请求日志输出方式,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教2022-03-03


最新评论