溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Spring Boot集成Apollo報Cause: [status code: 404] Could not find config for namespace怎么解決

發(fā)布時間:2021-06-23 10:21:36 來源:億速云 閱讀:4602 作者:chen 欄目:大數(shù)據(jù)

這篇文章主要講解了“Spring Boot集成Apollo報Cause: [status code: 404] Could not find config for namespace怎么解決”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“Spring Boot集成Apollo報Cause: [status code: 404] Could not find config for namespace怎么解決”吧!

Spring Boot 集成 Apollo 報如下異常:

10:11:21.891 [main] WARN  c.c.f.a.i.RemoteConfigRepository - Load config failed, will retry in 1 SECONDS. appId: 201909261015778899, cluster: platform-tw, namespaces: application

10:11:35.087 [main] WARN  c.c.f.apollo.internals.DefaultConfig - Could not load config for namespace application from Apollo, please check whether the configs are released in Apollo! Return default value now!

10:12:28.291 [Apollo-RemoteConfigRepository-1] WARN  c.c.f.a.i.AbstractConfigRepository - Sync config failed, will retry. Repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository, reason: Load Apollo Config failed - appId: 201909261015778899, cluster: platform-tw, namespace: application, url: http://127.0.0.1:8001/configs/pf-core/platform-tw/application?ip=127.0.0.1&messages=%7B%22details%22%3A%7B%22pf-core%2Bplatform-tw%2Bapplication%22%3A5%2C%22pf-core%2Bdefault%2Bapplication%22%3A3%7D%7D [Cause: [status code: 404] Could not find config for namespace - appId: 201909261015778899, cluster: platform-tw, namespace: application, please check whether the configs are released in Apollo!]

開始有點奇怪,我在項目中并未使用application命名空間,application.properties配置如下:

# 應(yīng)用全局唯一的身份標(biāo)識
app.id = 20190926778899
# Apollo Meta Server 地址
apollo.meta = http://127.0.0.1:8011
# 自定義本地配置文件緩存路徑
# apollo.cacheDir = ./config
apollo.cluster = platform-tw
# 設(shè)置在應(yīng)用啟動階段就加載 Apollo 配置
apollo.bootstrap.enabled = true
# 注入 application namespace
apollo.bootstrap.namespaces = redis

經(jīng)查看源碼,開啟阿波羅配置注解@EnableApolloConfig(),默認命名空間為application,此處需注入命名空間為redis屬性配置,自然會出現(xiàn)不能加載異常,正常做法為把注解修改為:@EnableApolloConfig(value = {"redis"})

感謝各位的閱讀,以上就是“Spring Boot集成Apollo報Cause: [status code: 404] Could not find config for namespace怎么解決”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對Spring Boot集成Apollo報Cause: [status code: 404] Could not find config for namespace怎么解決這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI