apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.4k stars 26.42k forks source link

No provider available for the service #9243

Open kick-pixel opened 2 years ago

kick-pixel commented 2 years ago

This is my running environment:

2.3.7.RELEASE 2.2.6.RELEASE Hoxton.SR9 When I started the service, I found the following error log. What is the reason?? ``` 2021-11-09 17:50:15.903 service-patient [ main ] - [ ERROR ] [ com.alibaba.cloud.dubbo.service.DubboMetadataServiceInvocationHandler : 53 ] - Failed to invoke the method $invoke in the service org.apache.dubbo.rpc.service.GenericService. No provider available for the service service-project/com.alibaba.cloud.dubbo.service.DubboMetadataService:1.0.0 from registry 192.168.0.217:8848 on the consumer 192.168.0.143 using the dubbo version 2.7.8. Please check if the providers have been started and registered. org.apache.dubbo.rpc.RpcException: Failed to invoke the method $invoke in the service org.apache.dubbo.rpc.service.GenericService. No provider available for the service service-project/com.alibaba.cloud.dubbo.service.DubboMetadataService:1.0.0 from registry 192.168.0.217:8848 on the consumer 192.168.0.143 using the dubbo version 2.7.8. Please check if the providers have been started and registered. at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.checkInvokers(AbstractClusterInvoker.java:283) at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:59) at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:260) at org.apache.dubbo.rpc.cluster.interceptor.ClusterInterceptor.intercept(ClusterInterceptor.java:47) at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$InterceptorInvokerNode.invoke(AbstractCluster.java:92) at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:88) at org.apache.dubbo.rpc.cluster.support.registry.ZoneAwareClusterInvoker.doInvoke(ZoneAwareClusterInvoker.java:91) at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:260) at org.apache.dubbo.rpc.cluster.interceptor.ClusterInterceptor.intercept(ClusterInterceptor.java:47) at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$InterceptorInvokerNode.invoke(AbstractCluster.java:92) ``` ![image](https://user-images.githubusercontent.com/6881633/140906828-70a68739-a772-46b0-be0c-badaa3d3babe.png)
WuJingLearn commented 2 years ago

不健康

kick-pixel commented 2 years ago

不健康

啥意思

lvanYi commented 2 years ago

我也遇见了同样的问题 只是启动时报错 测试服务间调用没有问题,你有没有找到解决办法

juzi214032 commented 2 years ago

@lvanYi @kick-pixel 是用了泛化调用吗,如果是的话,设置一下referenceConfig.setCheck(false);

lvanYi commented 2 years ago

@lvanYi @kick-pixel 是用了泛化调用吗,如果是的话,设置一下referenceConfig.setCheck(false);

com.alibaba.cloud.dubbo.service.DubboMetadataService本身就是泛化调用的,我不知道该咋办了 目前的情况代码内没有进行泛化调用,但是启动的时候会报这个错,同样的错会反复报很多次,但是项目可以正常启动,可以正常服务见调用。nacos里面tms-sys-service/com.alibaba.cloud.dubbo.service.DubboMetadataService:1.0.0 是正常注册上了的

2022-01-25 15:17:23.976 ERROR 25036 --- [           main] .s.DubboMetadataServiceInvocationHandler : Failed to invoke the method $invoke in the service org.apache.dubbo.rpc.service.GenericService. No provider available for the service tms-sys-service/com.alibaba.cloud.dubbo.service.DubboMetadataService:1.0.0 from registry 127.0.0.1:8848 on the consumer 192.168.3.5 using the dubbo version 2.7.13. Please check if the providers have been started and registered.

org.apache.dubbo.rpc.RpcException: Failed to invoke the method $invoke in the service org.apache.dubbo.rpc.service.GenericService. No provider available for the service tms-sys-service/com.alibaba.cloud.dubbo.service.DubboMetadataService:1.0.0 from registry 127.0.0.1:8848 on the consumer 192.168.3.5 using the dubbo version 2.7.13. Please check if the providers have been started and registered.
    at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.checkInvokers(AbstractClusterInvoker.java:288) ~[dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:59) ~[dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:265) ~[dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.rpc.cluster.interceptor.ClusterInterceptor.intercept(ClusterInterceptor.java:47) ~[dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$InterceptorInvokerNode.invoke(AbstractCluster.java:92) ~[dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:93) ~[dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.registry.client.migration.MigrationInvoker.invoke(MigrationInvoker.java:170) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.rpc.cluster.support.registry.ZoneAwareClusterInvoker.doInvoke(ZoneAwareClusterInvoker.java:103) ~[dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:265) ~[dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.rpc.cluster.interceptor.ClusterInterceptor.intercept(ClusterInterceptor.java:47) ~[dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$InterceptorInvokerNode.invoke(AbstractCluster.java:92) ~[dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:96) ~[dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.common.bytecode.proxy0.$invoke(proxy0.java) ~[dubbo-2.7.13.jar:2.7.13]
    at com.alibaba.cloud.dubbo.service.DubboMetadataServiceInvocationHandler.invoke(DubboMetadataServiceInvocationHandler.java:48) ~[spring-cloud-starter-dubbo-2.2.7.RELEASE.jar:2.2.7.RELEASE]
    at com.sun.proxy.$Proxy162.getExportedURLs(Unknown Source) [na:na]
    at com.alibaba.cloud.dubbo.registry.GenearalServiceSubscribeHandler.getExportedURLs(GenearalServiceSubscribeHandler.java:269) [spring-cloud-starter-dubbo-2.2.7.RELEASE.jar:2.2.7.RELEASE]
    at com.alibaba.cloud.dubbo.registry.GenearalServiceSubscribeHandler.getTemplateExportedURLs(GenearalServiceSubscribeHandler.java:242) [spring-cloud-starter-dubbo-2.2.7.RELEASE.jar:2.2.7.RELEASE]
    at com.alibaba.cloud.dubbo.registry.GenearalServiceSubscribeHandler.init(GenearalServiceSubscribeHandler.java:126) [spring-cloud-starter-dubbo-2.2.7.RELEASE.jar:2.2.7.RELEASE]
    at com.alibaba.cloud.dubbo.registry.GenearalServiceSubscribeHandler.doInit(GenearalServiceSubscribeHandler.java:118) [spring-cloud-starter-dubbo-2.2.7.RELEASE.jar:2.2.7.RELEASE]
    at com.alibaba.cloud.dubbo.registry.AbstractServiceSubscribeHandler.init(AbstractServiceSubscribeHandler.java:84) [spring-cloud-starter-dubbo-2.2.7.RELEASE.jar:2.2.7.RELEASE]
    at com.alibaba.cloud.dubbo.registry.DubboCloudRegistry.doSubscribe(DubboCloudRegistry.java:231) [spring-cloud-starter-dubbo-2.2.7.RELEASE.jar:2.2.7.RELEASE]
    at org.apache.dubbo.registry.support.FailbackRegistry.subscribe(FailbackRegistry.java:299) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.registry.ListenerRegistryWrapper.subscribe(ListenerRegistryWrapper.java:105) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.registry.integration.RegistryDirectory.subscribe(RegistryDirectory.java:95) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.registry.integration.RegistryProtocol.doCreateInvoker(RegistryProtocol.java:525) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.registry.integration.InterfaceCompatibleRegistryProtocol.getInvoker(InterfaceCompatibleRegistryProtocol.java:63) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.registry.client.migration.MigrationInvoker.refreshInterfaceInvoker(MigrationInvoker.java:333) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.registry.client.migration.MigrationInvoker.migrateToServiceDiscoveryInvoker(MigrationInvoker.java:113) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.registry.client.migration.MigrationRuleHandler.doMigrate(MigrationRuleHandler.java:58) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.registry.client.migration.MigrationRuleListener.onRefer(MigrationRuleListener.java:103) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.registry.integration.RegistryProtocol.interceptInvoker(RegistryProtocol.java:498) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:483) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:477) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:72) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:81) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.qos.protocol.QosProtocolWrapper.refer(QosProtocolWrapper.java:73) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:385) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:313) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:206) [dubbo-2.7.13.jar:2.7.13]
    at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.doGetInjectedBean(ReferenceAnnotationBeanPostProcessor.java:165) [dubbo-2.7.13.jar:2.7.13]
    at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.getInjectedObject(AbstractAnnotationBeanPostProcessor.java:409) [spring-context-support-1.0.11.jar:na]
    at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor$AnnotatedFieldElement.inject(AbstractAnnotationBeanPostProcessor.java:626) [spring-context-support-1.0.11.jar:na]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) [spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
    at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.postProcessPropertyValues(AbstractAnnotationBeanPostProcessor.java:179) [spring-context-support-1.0.11.jar:na]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1430) [spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) [spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) [spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) [spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) [spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) [spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.15.RELEASE.jar:5.2.15.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.15.RELEASE.jar:5.2.15.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:755) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:402) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1247) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1236) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
    at org.ggicj.Application.main(Application.java:30) ~[classes/:na]
juzi214032 commented 2 years ago

@lvanYi com.alibaba.cloud.dubbo.service.DubboMetadataService 这是哪个jar包里面的?dubbo 本身好像没有这个类

lvanYi commented 2 years ago

com.alibaba.cloud.dubbo.service.DubboMetadataService

image 是这个包里面的

juzi214032 commented 2 years ago

https://github.com/alibaba/spring-cloud-alibaba 去这里提个issue吧 根据你的日志我没看出问题在哪儿

ghost commented 2 years ago

我也遇见了同样的问题 只是启动时报错 测试服务间调用没有问题,你有没有找到解决办法

我也遇见了一模一样的情况,启动时报这个错,但是服务之间的rpc调用是OK的。

您这边解决了吗?

附图我的相关依赖 image

lvanYi commented 2 years ago

我也遇见了同样的问题 只是启动时报错 测试服务间调用没有问题,你有没有找到解决办法

我也遇见了一模一样的情况,启动时报这个错,但是服务之间的rpc调用是OK的。

您这边解决了吗?

附图我的相关依赖 image

没解决 就先这样用着了

ghost commented 2 years ago

我也遇见了同样的问题 只是启动时报错 测试服务间调用没有问题,你有没有找到解决办法

我也遇见了一模一样的情况,启动时报这个错,但是服务之间的rpc调用是OK的。 您这边解决了吗? 附图我的相关依赖 image

没解决 就先这样用着了

我把启动类的EnableDubbo换成了EnableDiscoveryClient后,有几个服务解决了,但是还是有一个服务每次启动时都会报。

baymax55 commented 2 years ago

如果注册中心地址使用了nacos协议,检查是否使用dubbo.cloud.subscribed-services,如果有,注释调试试,即不用订阅服务(nacos默认是接口发现)

dubbo:
  cloud:
    #subscribed-services:  dms-service-provider
lvanYi commented 2 years ago

如果注册中心地址使用了nacos协议,检查是否使用dubbo.cloud.subscribed-services,如果有,注释调试试,即不用订阅服务(nacos默认是接口发现)

dubbo:
  cloud:
    #subscribed-services:  dms-service-provider

感谢 我去尝试一下

lvanYi commented 2 years ago

如果注册中心地址使用了nacos协议,检查是否使用dubbo.cloud.subscribed-services,如果有,注释调试试,即不用订阅服务(nacos默认是接口发现)

dubbo:
  cloud:
    #subscribed-services:  dms-service-provider

我尝试了这个方法 问题依旧

rowstop commented 2 years ago

如果注册中心地址使用了nacos协议,检查是否使用dubbo.cloud.subscribed-services,如果有,注释调试试,即不用订阅服务(nacos默认是接口发现)

dubbo:
  cloud:
    #subscribed-services:  dms-service-provider

有没有什么办法能动态订阅,我不想用*订阅所有服务,我只有跑的时候才去有可能订阅服务

AlbumenJ commented 2 years ago

如果注册中心地址使用了nacos协议,检查是否使用dubbo.cloud.subscribed-services,如果有,注释调试试,即不用订阅服务(nacos默认是接口发现)

dubbo:
  cloud:
    #subscribed-services:  dms-service-provider

有没有什么办法能动态订阅,我不想用*订阅所有服务,我只有跑的时候才去有可能订阅服务

使用原生 Dubbo 3 的应用级服务发现是能支持的,使用 Spring Cloud Alibaba 版本由于缺失服务映射无法支持

wangzihaogithub commented 1 year ago

springcloud 需要加上这个

dubbo.cloud.registry-type: 'spring-cloud'

wangzihaogithub commented 1 year ago

不过我和你一样, 每次加新接口总报 No provider available for the service

AlbumenJ commented 1 year ago

不过我和你一样, 每次加新接口总报 No provider available for the service

加接口后 provider 已经发布了嘛

lvanYi commented 1 year ago

不过我和你一样, 每次加新接口总报 No provider available for the service

我加上解决了,什么原理

wangzihaogithub commented 1 year ago

不过我和你一样, 每次加新接口总报 No provider available for the service

加接口后 provider 已经发布了嘛

当然。我确认发布了

wangzihaogithub commented 1 year ago

不过我和你一样, 每次加新接口总报 No provider available for the service

我加上解决了,什么原理

因为spring-cloud,新版有两种模式,新版默认使用的dubbo的新模式, 加spring-cloud是使用旧版模式。

我将我这几年遇到并解决的问题,列在下面这个git地址里了

https://github.com/wangzihaogithub/spring-cloud-alibaba-dubbo-issues-1595

spring-cloud-alibaba-dubbo-issues-1595 (解决一些项目中遇到的问题)

项目介绍(总共就4个Java文件)

分享一些作者在用spring-cloud-alibaba-dubbo时项目中遇到的问题, 通过将下面文件,路径原封不动复制到项目里,以达到覆盖源码的方式解决。

1. 重写AbstractSpringCloudRegistry.class以解决获得支持

  同时需要在yml里加 
    dubbo.cloud.registry-type: 'spring-cloud'
    dubbo.consumer.reconnect: true
    dubbo.consumer.parameters.send.reconnect: true

  1.服务挂不上No provider
  2.一直掉老IP/端口 
  3.允许提供者与消费者无序启动 
  4.允许 -kill 9

2. 重写DubboGenericServiceFactory.class以解决获得支持

  1.解决接入其他注册中心(例:zk)的dubbo接口时,接口元信息可能会掉到其他注册中心上
  2.解决一直掉老IP/端口

3. 重写ReferenceAnnotationBeanPostProcessor.class以解决获得支持

  1.解决升级dubbo-2.7.15后,自定义注解用不了

4. 重写NetUtils.class以解决获得支持

  1.解决开VPN时, 有时获取VPN的IP,有时获取正常IP,导致服务掉不通。 
  2.解决开发环境多网卡时,IP总随机。
lvanYi commented 1 year ago

不过我和你一样, 每次加新接口总报 No provider available for the service

我加上解决了,什么原理

因为spring-cloud,新版有两种模式,新版默认使用的dubbo的新模式, 加spring-cloud是使用旧版模式。

我将我这几年遇到并解决的问题,列在下面这个git地址里了

https://github.com/wangzihaogithub/spring-cloud-alibaba-dubbo-issues-1595

spring-cloud-alibaba-dubbo-issues-1595 (解决一些项目中遇到的问题)

项目介绍(总共就4个Java文件)

分享一些作者在用spring-cloud-alibaba-dubbo时项目中遇到的问题, 通过将下面文件,路径原封不动复制到项目里,以达到覆盖源码的方式解决。

1. 重写AbstractSpringCloudRegistry.class以解决获得支持

  同时需要在yml里加 
    dubbo.cloud.registry-type: 'spring-cloud'
    dubbo.consumer.reconnect: true
    dubbo.consumer.parameters.send.reconnect: true

  1.服务挂不上No provider
  2.一直掉老IP/端口 
  3.允许提供者与消费者无序启动 
  4.允许 -kill 9

2. 重写DubboGenericServiceFactory.class以解决获得支持

  1.解决接入其他注册中心(例:zk)的dubbo接口时,接口元信息可能会掉到其他注册中心上
  2.解决一直掉老IP/端口

3. 重写ReferenceAnnotationBeanPostProcessor.class以解决获得支持

  1.解决升级dubbo-2.7.15后,自定义注解用不了

4. 重写NetUtils.class以解决获得支持

  1.解决开VPN时, 有时获取VPN的IP,有时获取正常IP,导致服务掉不通。 
  2.解决开发环境多网卡时,IP总随机。

dubbo.consumer.reconnect: true dubbo.consumer.parameters.send.reconnect: true 这两条我一直没有加,目前基本上没有出现找不到提供者的情况,我不清楚不加有没有风险,或者说加上会不会出现别的问题

wangzihaogithub commented 1 year ago

不过我和你一样, 每次加新接口总报 No provider available for the service

我加上解决了,什么原理

因为spring-cloud,新版有两种模式,新版默认使用的dubbo的新模式, 加spring-cloud是使用旧版模式。 我将我这几年遇到并解决的问题,列在下面这个git地址里了 https://github.com/wangzihaogithub/spring-cloud-alibaba-dubbo-issues-1595

spring-cloud-alibaba-dubbo-issues-1595 (解决一些项目中遇到的问题)

项目介绍(总共就4个Java文件)

分享一些作者在用spring-cloud-alibaba-dubbo时项目中遇到的问题, 通过将下面文件,路径原封不动复制到项目里,以达到覆盖源码的方式解决。 1. 重写AbstractSpringCloudRegistry.class以解决获得支持

  同时需要在yml里加 
    dubbo.cloud.registry-type: 'spring-cloud'
    dubbo.consumer.reconnect: true
    dubbo.consumer.parameters.send.reconnect: true

  1.服务挂不上No provider
  2.一直掉老IP/端口 
  3.允许提供者与消费者无序启动 
  4.允许 -kill 9

2. 重写DubboGenericServiceFactory.class以解决获得支持

  1.解决接入其他注册中心(例:zk)的dubbo接口时,接口元信息可能会掉到其他注册中心上
  2.解决一直掉老IP/端口

3. 重写ReferenceAnnotationBeanPostProcessor.class以解决获得支持

  1.解决升级dubbo-2.7.15后,自定义注解用不了

4. 重写NetUtils.class以解决获得支持

  1.解决开VPN时, 有时获取VPN的IP,有时获取正常IP,导致服务掉不通。 
  2.解决开发环境多网卡时,IP总随机。

dubbo.consumer.reconnect: true dubbo.consumer.parameters.send.reconnect: true 这两条我一直没有加,目前基本上没有出现找不到提供者的情况,我不清楚不加有没有风险,或者说加上会不会出现别的问题

如果目前没问题的话,就先保持着。 等你遇到问题了,可以回来看我说的这些。 因为我也是开始没问题,随着项目引入的变量越多,才慢慢的发生了这些问题。