RpcException: No provider available from registry
程序员文章站
2022-07-15 14:28:56
...
在使用dubbo调用服务时,报No provider错误,错误信息如下:
com.alibaba.dubbo.rpc.RpcException: No provider available from registry 47.98.198.11:2181 for service xzf/com.sangular.dolphin.api.item.AttributeServiceRemote:1.0.1 on consumer 192.168.3.90 use dubbo version 2.6.2, please check status of providers(disabled, not registered or in blacklist).
at com.alibaba.dubbo.registry.integration.RegistryDirectory.doList(RegistryDirectory.java:575) ~[dubbo-2.6.2.jar:2.6.2]
at com.alibaba.dubbo.rpc.cluster.directory.AbstractDirectory.list(AbstractDirectory.java:74) ~[dubbo-2.6.2.jar:2.6.2]
at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.list(AbstractClusterInvoker.java:271) ~[dubbo-2.6.2.jar:2.6.2]
at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:232) ~[dubbo-2.6.2.jar:2.6.2]
at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:75) ~[dubbo-2.6.2.jar:2.6.2]
at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:52) ~[dubbo-2.6.2.jar:2.6.2]
at com.alibaba.dubbo.common.bytecode.proxy0.searchAttListName(proxy0.java) ~[dubbo-2.6.2.jar:2.6.2]
at com.sangular.dolphin.distributor.web.rest.item.AttributeController.searchAttListName(AttributeController.java:91) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
经过排查,发现是由于服务提供者的版本和消费者的版本不一致导致的,修改提供者的yml配置如下:
profile: dev_envrimont
#provider
server:
port: 8001
management:
port: 8011
spring:
datasource:
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://*****
username: ***
password: ***
aop:
aspectj-autoproxy: true
dubbo:
application:
name: dolphin_server_item
owner: Dale
version: 1.0.1
registry:
address: zookeeper://***
file: dubbo-registry.properties
protocol:
name: dubbo
port: 20880
scan:
basePackages: com.sangular.dolphin.item.impl
service:
group: xzf
version: 1.0.1
同时将消费者的版本号和提供者保持一致
profile: dev_envrimont
server:
port: 8005
#management:
# server:
# port: 7012
dubbo:
application:
name: dolphin_distributor
owner: Dale
environment: 1.0.1
registry:
address: zookeeper://***
file: dubbo-registry.properties
protocol:
name: dubbo
port: 20880
consumer:
check: false
version: 1.0.1
monitor:
protocol: registry
reference:
group: xzf
scan: com.sangular.dolphin.distributor
问题解决
推荐阅读
-
异常处理com.alibaba.dubbo.rpc.RpcException: No provider available from registry 127.0.0.1:2181 for
-
RpcException: No provider available from registry
-
No provider available from registry
-
RpcException: No provider available from registry
-
com.alibaba.dubbo.rpc.RpcException: No provider available from
-
com.alibaba.dubbo.rpc.RpcException: No provider available from registry stable.zk.scsite.net:21异常解决
-
No provider available from registry 192.168.126.129:2181 for service com.jt.service.DubboUserServic
-
nacos dubbo 使用时遇到报错 No provider available from registry localhost:9090