[NACOS ConnectException httpPost] currentServerAddr: http://localhost:8848, err : Connection refused

具体报错信息:
18:40:24.282 [com.alibaba.nacos.client.Worker.longPolling.fixed-localhost_8848] ERROR c.a.n.c.c.h.ServerHttpAgent - [httpPost,166] - [NACOS ConnectException httpPost] currentServerAddr: http://localhost:8848, err : Connection refused: connect
18:40:25.127 [SpringContextShutdownHook] INFO  c.a.n.client.naming - [shutdown,132] - com.alibaba.nacos.client.naming.core.PushReceiver do shutdown begin
18:40:26.325 [com.alibaba.nacos.client.Worker.longPolling.fixed-localhost_8848] ERROR c.a.n.c.c.h.ServerHttpAgent - [httpPost,166] - [NACOS ConnectException httpPost] currentServerAddr: http://localhost:8848, err : Connection refused: connect
分析原因:
连接 nacos 错误的连接到了 localhost,这和配置想要的大相径庭,可以确定一定是少了配置(因为一般没有配置成本地的情况下,localhost都是找不到对应配置的参数,然后采用了默认的配置)
其次连接nacos无非就是两个目的:服务,配置(注册、订阅服务,获取nacos共享配置)
服务的已经通过 spring.cloud.nacos.discovery 配置了,那么就是少了配置文件的了,加上 spring.cloud.nacos.config 然后就是地址,命名空间一搞 ,然后ok了
最终解决: 
添加了config的发现地址和命名空间

拓展:
bootstrap.yml 会比 application.yml 提前执行

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据引用内容,出现[NACOS ConnectException httpGet] currentServerAddr:http://localhost:8848, err : Connection refused (Connection refused)的错误提示是因为在配置文件中没有正确配置Nacos的地址。根据引用,你可以在bootstrap.yml文件中将config的enabled属性设置为false来关闭配置功能。然后,根据引用,你需要配置Nacos的地址,将spring.cloud.nacos.discovery.server-addr属性设置为正确的Nacos服务器地址。最后,根据引用,将spring.cloud.nacos.config.server-addr属性设置为正确的Nacos服务器地址,并将spring.cloud.nacos.config.enabled属性设置为true。这样配置后,应该能够解决连接被拒绝的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [SpringCloud-11-解决[NACOS HTTP-GET] The maximum number of tolerable server reconnection errors has ...](https://blog.csdn.net/IOT_LI/article/details/127365779)[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%"] - *2* *3* [currentServerAddr:http://localhost:8848, err : Connection refused (Connection refused)](https://blog.csdn.net/zhangyupeng0528/article/details/123113688)[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 ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值