alibaba / nacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
https://nacos.io
Apache License 2.0
30.35k stars 12.86k forks source link

There is no content for NacosPropertySource #12838

Open Xiaobai01 opened 1 week ago

Xiaobai01 commented 1 week ago

Issue Description

java应用获取不到nacos的配置中心的配置文件

Describe what happened (or what feature you want)

在nacos的public ns中创建了配置文件,但是在本地仍然获取不到对应的配置。

Describe what you expected to happen

How to reproduce it (as minimally and precisely as possible)

Tell us your environment

在本地【Mac电脑M2 MAX】使用docker启动了nacos的镜像 server端是ARM版本的镜像[v2.3.1-slim],client端为nacos-config-spring-boot-starter的0.2.12版本

Anything else we need to know?

配置信息如下: nacos: config: server-addr: 127.0.0.1:8848

主类使用NacosPropertySource注解 @NacosPropertySource(dataId = "test.yaml", autoRefreshed = true)

报错信息如下: 2024-11-12 12:09:18.528 INFO 99713 [main] c.a.nacos.plugin.auth.spi.client.ClientAuthPluginManager:init:56 [ClientAuthPluginManager] Load ClientAuthService com.alibaba.nacos.client.auth.impl.NacosClientAuthServiceImpl success. 2024-11-12 12:09:18.528 INFO 99713 [main] c.a.nacos.plugin.auth.spi.client.ClientAuthPluginManager:init:56 [ClientAuthPluginManager] Load ClientAuthService com.alibaba.nacos.client.auth.ram.RamClientAuthServiceImpl success. 2024-11-12 12:09:19.160 WARN 99713 [main] c.a.nacos.spring.core.env.AbstractNacosPropertySourceBuilder:doBuild:188 There is no content for NacosPropertySource from dataId[test.yaml] , groupId[DEFAULT_GROUP] , properties[{accessKey=${nacos.access-key:}, clusterName=${nacos.cluster-name:}, configLongPollTimeout=${nacos.configLongPollTimeout:}, configRetryTime=${nacos.configRetryTime:}, contextPath=${nacos.context-path:}, enableRemoteSyncConfig=${nacos.enableRemoteSyncConfig:}, encode=${nacos.encode:UTF-8}, endpoint=${nacos.endpoint:}, maxRetry=${nacos.maxRetry:}, namespace=${nacos.namespace:}, password=${nacos.password:}, secretKey=${nacos.secret-key:}, serverAddr=${nacos.server-addr:}, username=${nacos.username:}}]

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'decryptingBeanPostProcessor': Injection of @NacosValue dependencies is failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'db.host' in value "${db.host}"

KomachiSion commented 1 week ago

see ${user.home}/logs/nacos/config.log to find out whether config has found and got from nacos server.

Xiaobai01 commented 1 week ago

我在容器中没有找到home/logs/nacos/config.log路径,但是找到了/home/nacos/logs路径,并且logs路径下不存在nacos文件夹及config.log文件 ![Uploading nacos.jpg…]()

Xiaobai01 commented 1 week ago

您好!        我已在github上进行回复,并没有找到您告知的路径,只找到了图片内的路径且并没有找到conf.log文件。不清楚是否是镜像不对呢?

桃^子§妖妖 @.***

 

------------------ 原始邮件 ------------------ 发件人: "alibaba/nacos" @.>; 发送时间: 2024年11月12日(星期二) 下午3:33 @.>; @.**@.>; 主题: Re: [alibaba/nacos] There is no content for NacosPropertySource (Issue #12838)

see ${user.home}/logs/nacos/config.log to find out whether config has found and got from nacos server.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

KomachiSion commented 1 week ago

在应用所在的节点找日志,而不是在nacos server。

Xiaobai01 commented 1 week ago

敬好!        我在本地进行调试,发现nacos远端的文件是下载下来了,但是下载所以的路径与JAVA的SDK中的校验路径不一样,所以没有获取到文件内容 不太清楚是哪里出问题了。

桃^子§妖妖 @.***

 

------------------ 原始邮件 ------------------ 发件人: "alibaba/nacos" @.>; 发送时间: 2024年11月14日(星期四) 下午2:14 @.>; @.**@.>; 主题: Re: [alibaba/nacos] There is no content for NacosPropertySource (Issue #12838)

在应用所在的节点找日志,而不是在nacos server。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

Xiaobai01 commented 1 week ago

敬好!  

       我在本地进行了断点,使用了nacos用户进行连接,但是结果是报了403 user not found

同时我使用相同的用户名和密码已经通过控制台成功发布文件了

因此想了解是我哪里疏忽了呢?数据库我没有单独配置,直接启动镜像使用的docker默认数据库 代码配置如下: nacos.config.server-addr=localhost:8848 nacos.config.secret-key=nacos nacos.config.access-key=nacos

期待您的回复

桃^子§妖妖 @.***

 

------------------ 原始邮件 ------------------ 发件人: "alibaba/nacos" @.>; 发送时间: 2024年11月14日(星期四) 下午2:14 @.>; @.**@.>; 主题: Re: [alibaba/nacos] There is no content for NacosPropertySource (Issue #12838)

在应用所在的节点找日志,而不是在nacos server。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

KomachiSion commented 1 day ago

不是应该配置username和password吗?