找不到注册中心:No such any registry to refer service in consumer

 今天学习使用dubbo时报如下错误,没有找到dubbo注册中心

Caused by: java.lang.IllegalStateException: No such any registry to refer service in consumer 192.168.48.1 use dubbo version 2.6.0, Please add <dubbo:registry address="..." /> to your spring config. If you want unregister, please set <dubbo:service registry="N/A" />
	at com.alibaba.dubbo.config.AbstractInterfaceConfig.checkRegistry(AbstractInterfaceConfig.java:120) ~[dubbo-2.6.0.jar:2.6.0]
	at com.alibaba.dubbo.config.AbstractInterfaceConfig.loadRegistries(AbstractInterfaceConfig.java:160) ~[dubbo-2.6.0.jar:2.6.0]
	at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:378) ~[dubbo-2.6.0.jar:2.6.0]
	at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:333) ~[dubbo-2.6.0.jar:2.6.0]
	at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:163) ~[dubbo-2.6.0.jar:2.6.0]
	at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:59) ~[dubbo-2.6.0.jar:2.6.0]
	at com.alibaba.dubbo.spring.boot.DubboConsumerAutoConfiguration$1.postProcessBeforeInitialization(DubboConsumerAutoConfiguration.java:89) ~[dubbo-spring-boot-starter-2.0.0.jar:na]
	... 18 common frames omitted

解决办法:

错误提示可以解决

1.使用直连模式

spring:
  dubbo:
    registry: N/A

2.使用注册中心

spring:
  dubbo:
    registry: zookeeper://192.168.48.5:2181

如果你已经配置了以上一种方式,但是仍然报该错误,那么请你仔细检查你的配置文件(我因为yml缩进格式不对导致该错误,配置任何的注册中心都指向了本地地址)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值