[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 提前执行

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值