使用dubbox作为服务提供端很好实现,因为git的说明和网上有很多的例子可供参考,但是消费端都一笔带过,简单得很,初学者往往以为只要配置如下3样东西就够了:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:annotation-config /> <!-- 消费方应用信息,用于计算依赖关系 -->
<dubbo:application name="zr_consumer" /> <dubbo:registry address="zookeeper://127.0.0.1:2181" /> <!-- 消费者接口 -->
<dubbo:reference id="mobileZoneResourceService"
interface="com.inspur.zoneresource.api.MobileZoneResourceService" /> </beans>

  

  很多例子会写个main方法读取上面这个配置文件,然后调用里面mobileZoneResourceService这个bean里的方法,然后就没了。但我们消费端一般是提供给外部用的,而不是用来写测试类用的。而且这里有个问题:不会到zookeeper注册中心去把消费端注册上去,虽然启动是不会报错的:

INFO: Initializing Spring root WebApplicationContext
[16/08/17 06:24:53:053 CST] localhost-startStop-1 INFO context.ContextLoader: Root WebApplicationContext: initialization started
[16/08/17 06:24:54:054 CST] localhost-startStop-1 INFO support.XmlWebApplicationContext: Refreshing Root WebApplicationContext: startup date [Wed Aug 16 18:24:54 CST 2017]; root of context hierarchy
[16/08/17 06:24:54:054 CST] localhost-startStop-1 INFO xml.XmlBeanDefinitionReader: Loading XML bean definitions from class path resource [META-INF/spring/consumer.xml]
[16/08/17 06:24:54:054 CST] localhost-startStop-1 INFO logger.LoggerFactory: using logger: com.alibaba.dubbo.common.logger.log4j.Log4jLoggerAdapter
[16/08/17 06:24:55:055 CST] localhost-startStop-1 INFO support.PropertySourcesPlaceholderConfigurer: Loading properties file from class path resource [global.properties]
[16/08/17 06:24:55:055 CST] localhost-startStop-1 INFO support.DefaultListableBeanFactory: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@14f205ce: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,zr_consumer,org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,com.alibaba.dubbo.config.RegistryConfig,mobileZoneResourceService,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
[16/08/17 06:24:55:055 CST] localhost-startStop-1 INFO context.ContextLoader: Root WebApplicationContext: initialization completed in 2188 ms
八月 16, 2017 6:24:56 下午 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8081"]
八月 16, 2017 6:24:56 下午 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
八月 16, 2017 6:24:56 下午 org.apache.catalina.startup.Catalina start
INFO: Server startup in 12599 ms

  消费端引入服务端接口的目的就是为了调用,所以这里应该还有一个bean,用来使用引入的接口:

    <!-- 对外control -->
<bean id="mobileZoneResourceController"
class="com.inspur.zoneresource.consumer.control.MobileZoneResourceController" />

  此时我们可以看到消费端已经去找zookeeper注册了,但这里我本地没有启动zk,所以会报连接超时:

INFO: Initializing Spring root WebApplicationContext
[16/08/17 06:41:05:005 CST] localhost-startStop-1 INFO context.ContextLoader: Root WebApplicationContext: initialization started
[16/08/17 06:41:05:005 CST] localhost-startStop-1 INFO support.XmlWebApplicationContext: Refreshing Root WebApplicationContext: startup date [Wed Aug 16 18:41:05 CST 2017]; root of context hierarchy
[16/08/17 06:41:05:005 CST] localhost-startStop-1 INFO xml.XmlBeanDefinitionReader: Loading XML bean definitions from class path resource [META-INF/spring/consumer.xml]
[16/08/17 06:41:05:005 CST] localhost-startStop-1 INFO logger.LoggerFactory: using logger: com.alibaba.dubbo.common.logger.log4j.Log4jLoggerAdapter
[16/08/17 06:41:06:006 CST] localhost-startStop-1 INFO support.PropertySourcesPlaceholderConfigurer: Loading properties file from class path resource [global.properties]
[16/08/17 06:41:06:006 CST] localhost-startStop-1 INFO support.DefaultListableBeanFactory: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3273d766: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,zr_consumer,org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,com.alibaba.dubbo.config.RegistryConfig,mobileZoneResourceService,mobileZoneResourceController,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
[16/08/17 06:41:07:007 CST] localhost-startStop-1 INFO zookeeper.ZookeeperRegistry: [DUBBO] Load registry store file C:\Users\wulf\.dubbo\dubbo-registry-127.0.0.1.cache, data: {annotationConfig/com.alibaba.dubbo.demo.user.facade.UserRestService=empty://10.73.158.209:20880/com.alibaba.dubbo.demo.user.facade.UserRestService?anyhost=true&application=demo-provider&category=configurators&check=false&dubbo=2.0.0&generic=false&group=annotationConfig&interface=com.alibaba.dubbo.demo.user.facade.UserRestService&methods=getUser,registerUser&optimizer=com.alibaba.dubbo.demo.SerializationOptimizerImpl&organization=dubbox&owner=programmer&pid=7300&serialization=kryo&side=provider&timestamp=1502445463813&validation=true, com.inspur.zoneresource.api.MobileZoneResourceService=empty://10.73.158.209/com.inspur.zoneresource.api.MobileZoneResourceService?application=zr_consumer&category=configurators&dubbo=2.8.4&interface=com.inspur.zoneresource.api.MobileZoneResourceService&methods=retrieveSplitBoxPage,retrieveZonePage,retrieveUnitInfoList,retrieveMediaBoxDeviceTopo,retrieveCustomerTopo,retrieveAccountInfo,retrieveOnuInfo,retrieveMediaBoxInfoAndCover,retrieveFlangeInfo,retrieveBoxCoverZoneList,retrieveSplitBoxInfoAndCover,retrieveBrasInfo,retrieveZoneBuildingAndUnitList,retrieveMediaBoxPage,retrieveCustomerInfoList,retrieveSplitBoxDeviceTopo,retrieveZoneBoxStatitics,retrieveMediaBoxCoverCustomerList,retrieveFlangeList,retrieveTransBoxDeviceTopo,retrievePosPage,retrievePosList,retrieveSplitBoxCoverCustomerList,retrieveTransBoxCoverAndCustomer,retrieveOltInfo,retrieveFlangePage,retrieveZoneBoxTopo,retrieveCustomerPage,retrieveMediaBoxDeviceStatitics,retrieveTransBoxPage,retrievePosInfo,retrieveTransBoxDeviceStatitics,retrieveZoneDeviceStatitics,retrieveSplitBoxList,retrieveSplitBoxDeviceStatitics,retrieveOnuList,retrieveOnuPage,retrievePonResourcePage,queryCityList,retrieveMediaBoxList&pid=13428&revision=0.0.1-SNAPSHOT&side=consumer&timestamp=1502688538039 empty://10.73.158.209/com.inspur.zoneresource.api.MobileZoneResourceService?application=zr_consumer&category=routers&dubbo=2.8.4&interface=com.inspur.zoneresource.api.MobileZoneResourceService&methods=retrieveSplitBoxPage,retrieveZonePage,retrieveUnitInfoList,retrieveMediaBoxDeviceTopo,retrieveCustomerTopo,retrieveAccountInfo,retrieveOnuInfo,retrieveMediaBoxInfoAndCover,retrieveFlangeInfo,retrieveBoxCoverZoneList,retrieveSplitBoxInfoAndCover,retrieveBrasInfo,retrieveZoneBuildingAndUnitList,retrieveMediaBoxPage,retrieveCustomerInfoList,retrieveSplitBoxDeviceTopo,retrieveZoneBoxStatitics,retrieveMediaBoxCoverCustomerList,retrieveFlangeList,retrieveTransBoxDeviceTopo,retrievePosPage,retrievePosList,retrieveSplitBoxCoverCustomerList,retrieveTransBoxCoverAndCustomer,retrieveOltInfo,retrieveFlangePage,retrieveZoneBoxTopo,retrieveCustomerPage,retrieveMediaBoxDeviceStatitics,retrieveTransBoxPage,retrievePosInfo,retrieveTransBoxDeviceStatitics,retrieveZoneDeviceStatitics,retrieveSplitBoxList,retrieveSplitBoxDeviceStatitics,retrieveOnuList,retrieveOnuPage,retrievePonResourcePage,queryCityList,retrieveMediaBoxList&pid=13428&revision=0.0.1-SNAPSHOT&side=consumer&timestamp=1502688538039 empty://10.73.158.209/com.inspur.zoneresource.api.MobileZoneResourceService?application=zr_consumer&category=providers&dubbo=2.8.4&interface=com.inspur.zoneresource.api.MobileZoneResourceService&methods=retrieveSplitBoxPage,retrieveZonePage,retrieveUnitInfoList,retrieveMediaBoxDeviceTopo,retrieveCustomerTopo,retrieveAccountInfo,retrieveOnuInfo,retrieveMediaBoxInfoAndCover,retrieveFlangeInfo,retrieveBoxCoverZoneList,retrieveSplitBoxInfoAndCover,retrieveBrasInfo,retrieveZoneBuildingAndUnitList,retrieveMediaBoxPage,retrieveCustomerInfoList,retrieveSplitBoxDeviceTopo,retrieveZoneBoxStatitics,retrieveMediaBoxCoverCustomerList,retrieveFlangeList,retrieveTransBoxDeviceTopo,retrievePosPage,retrievePosList,retrieveSplitBoxCoverCustomerList,retrieveTransBoxCoverAndCustomer,retrieveOltInfo,retrieveFlangePage,retrieveZoneBoxTopo,retrieveCustomerPage,retrieveMediaBoxDeviceStatitics,retrieveTransBoxPage,retrievePosInfo,retrieveTransBoxDeviceStatitics,retrieveZoneDeviceStatitics,retrieveSplitBoxList,retrieveSplitBoxDeviceStatitics,retrieveOnuList,retrieveOnuPage,retrievePonResourcePage,queryCityList,retrieveMediaBoxList&pid=13428&revision=0.0.1-SNAPSHOT&side=consumer&timestamp=1502688538039, com.alibaba.dubbo.demo.user.facade.AnotherUserRestService=empty://10.73.158.209/com.alibaba.dubbo.demo.user.facade.AnotherUserRestService?application=demo-consumer&category=configurators&dubbo=2.0.0&interface=com.alibaba.dubbo.demo.user.facade.AnotherUserRestService&methods=getUser,registerUser&organization=dubbox&owner=programmer&pid=17416&side=consumer&timestamp=1502446245480 empty://10.73.158.209/com.alibaba.dubbo.demo.user.facade.AnotherUserRestService?application=demo-consumer&category=routers&dubbo=2.0.0&interface=com.alibaba.dubbo.demo.user.facade.AnotherUserRestService&methods=getUser,registerUser&organization=dubbox&owner=programmer&pid=17416&side=consumer&timestamp=1502446245480 rest://10.73.158.209:8888/services/com.alibaba.dubbo.demo.user.facade.AnotherUserRestService?accepts=500&anyhost=true&application=demo-provider&connections=100&dubbo=2.0.0&extension=com.alibaba.dubbo.demo.extension.TraceInterceptor, com.alibaba.dubbo.demo.extension.TraceFilter, com.alibaba.dubbo.demo.extension.ClientTraceFilter, com.alibaba.dubbo.demo.extension.DynamicTraceBinding, com.alibaba.dubbo.demo.extension.CustomExceptionMapper, com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter&generic=false&interface=com.alibaba.dubbo.demo.user.facade.AnotherUserRestService&methods=getUser,registerUser&organization=dubbox&owner=programmer&pid=7300&server=tomcat&side=provider&threads=500&timeout=2000&timestamp=1502445466988&validation=true, com.alibaba.dubbo.demo.user.facade.UserRestService=empty://10.73.158.209:8888/services/com.alibaba.dubbo.demo.user.facade.UserRestService?accepts=500&anyhost=true&application=demo-provider&category=configurators&check=false&dubbo=2.0.0&extension=com.alibaba.dubbo.demo.extension.TraceInterceptor, com.alibaba.dubbo.demo.extension.TraceFilter, com.alibaba.dubbo.demo.extension.ClientTraceFilter, com.alibaba.dubbo.demo.extension.DynamicTraceBinding, com.alibaba.dubbo.demo.extension.CustomExceptionMapper, com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter&generic=false&interface=com.alibaba.dubbo.demo.user.facade.UserRestService&methods=getUser,registerUser&organization=dubbox&owner=programmer&pid=7300&server=tomcat&side=provider&threads=500&timestamp=1502445466549&validation=true, com.alibaba.dubbo.demo.bid.BidService=empty://10.73.158.209/com.alibaba.dubbo.demo.bid.BidService?application=demo-consumer&category=configurators&dubbo=2.0.0&interface=com.alibaba.dubbo.demo.bid.BidService&methods=throwNPE,bid&organization=dubbox&owner=programmer&pid=4616&side=consumer&timestamp=1502447793306 empty://10.73.158.209/com.alibaba.dubbo.demo.bid.BidService?application=demo-consumer&category=routers&dubbo=2.0.0&interface=com.alibaba.dubbo.demo.bid.BidService&methods=throwNPE,bid&organization=dubbox&owner=programmer&pid=4616&side=consumer&timestamp=1502447793306 empty://10.73.158.209/com.alibaba.dubbo.demo.bid.BidService?application=demo-consumer&category=providers&dubbo=2.0.0&interface=com.alibaba.dubbo.demo.bid.BidService&methods=throwNPE,bid&organization=dubbox&owner=programmer&pid=4616&side=consumer&timestamp=1502447793306, xmlConfig/com.alibaba.dubbo.demo.user.UserService=empty://10.73.158.209:20880/com.alibaba.dubbo.demo.user.UserService?anyhost=true&application=demo-provider&category=configurators&check=false&dubbo=2.0.0&generic=false&group=xmlConfig&interface=com.alibaba.dubbo.demo.user.UserService&methods=getUser,registerUser&optimizer=com.alibaba.dubbo.demo.SerializationOptimizerImpl&organization=dubbox&owner=programmer&pid=7300&serialization=kryo&side=provider&timestamp=1502445466063}, dubbo version: 2.8.4, current host: 127.0.0.1
[16/08/17 06:41:07:007 CST] ZkClient-EventThread-20-127.0.0.1:2181 INFO zkclient.ZkEventThread: Starting ZkClient event thread.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[16/08/17 06:41:12:012 CST] ZkClient-EventThread-20-127.0.0.1:2181 INFO zkclient.ZkEventThread: Terminate ZkClient event thread.
[16/08/17 06:41:13:013 CST] localhost-startStop-1 INFO support.DefaultListableBeanFactory: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3273d766: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,zr_consumer,org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,com.alibaba.dubbo.config.RegistryConfig,mobileZoneResourceService,mobileZoneResourceController,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
[16/08/17 06:41:13:013 CST] localhost-startStop-1 ERROR context.ContextLoader: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mobileZoneResourceController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.inspur.zoneresource.api.MobileZoneResourceService com.inspur.zoneresource.consumer.control.MobileZoneResourceController.mobileZoneResourceService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mobileZoneResourceService': FactoryBean threw exception on object creation; nested exception is org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 5000
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:633)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.jboss.resteasy.plugins.spring.SpringContextLoaderListener.contextInitialized(SpringContextLoaderListener.java:44)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.inspur.zoneresource.api.MobileZoneResourceService com.inspur.zoneresource.consumer.control.MobileZoneResourceController.mobileZoneResourceService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mobileZoneResourceService': FactoryBean threw exception on object creation; nested exception is org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 5000
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)
... 24 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mobileZoneResourceService': FactoryBean threw exception on object creation; nested exception is org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 5000
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1468)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:917)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:860)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:775)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489)
... 26 more
Caused by: org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 5000
at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:876)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:98)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:92)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:80)
at com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperClient.<init>(ZkclientZookeeperClient.java:26)
at com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperTransporter.connect(ZkclientZookeeperTransporter.java:10)
at com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter$Adpative.connect(ZookeeperTransporter$Adpative.java)
at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.<init>(ZookeeperRegistry.java:69)
at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistryFactory.createRegistry(ZookeeperRegistryFactory.java:37)
at com.alibaba.dubbo.registry.support.AbstractRegistryFactory.getRegistry(AbstractRegistryFactory.java:94)
at com.alibaba.dubbo.registry.RegistryFactory$Adpative.getRegistry(RegistryFactory$Adpative.java)
at com.alibaba.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:240)
at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:63)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:60)
at com.alibaba.dubbo.rpc.Protocol$Adpative.refer(Protocol$Adpative.java)
at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:392)
at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:300)
at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:138)
at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:65)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
... 34 more

  

  

dubbox消费者启动成功,却无法连接注册中心的更多相关文章

  1. SpringCloud学习笔记(1):Eureka注册中心

    简介 Eureka是Netflix开源的基于rest的服务治理方案,分为Server端和Client端,Server端为注册中心,其他微服务通过Client端连接Server端进行服务的注册和发现. ...

  2. idea搭建Eureka注册中心

    服务的注册与发现 关系调用说明: 服务生产者启动时,向服务注册中心注册自己提供的服务 服务消费者启动时,在服务注册中心订阅自己所需要的服务 注册中心返回服务提供者的地址信息个消费者 消费者从提供者中调 ...

  3. dubbo在idea下的使用创建 服务者,消费者 注册中心

    1.基于windows 下  spring 下的dubbo  需要书写配置文件 (1).创建带有web工程的项目 创建一个服务者 package cn.edu.aynu.bean; import lo ...

  4. Dubbo配置注册中心设置application的name使用驼峰命名法存在的隐藏项目启动异常问题

    原创/朱季谦 首先,先提一个建议,在SpringBoot+Dubbo项目中,Dubbo配置注册中心设置的application命名name的值,最好使用xxx-xxx-xxx这样格式的,避免随便使用驼 ...

  5. 学习一下 SpringCloud (二)-- 服务注册中心 Eureka、Zookeeper、Consul、Nacos

    (1) 相关博文地址: 学习一下 SpringCloud (一)-- 从单体架构到微服务架构.代码拆分(maven 聚合): https://www.cnblogs.com/l-y-h/p/14105 ...

  6. spring cloud(学习笔记)高可用注册中心(Eureka)的实现(二)

    绪论 前几天我用一种方式实现了spring cloud的高可用,达到两个注册中心,详情见spring cloud(学习笔记)高可用注册中心(Eureka)的实现(一),今天我意外发现,注册中心可以无限 ...

  7. Dubbo框架介绍与安装 Dubbo 注册中心(Zookeeper-3.4.6)

    背景 随着互联网的发展,网站应用的规模不断扩大,常规的垂直应用架构已无法应对,分布式服务架构以及流动计算架构势在必行,亟需一个治理系统确保架构有条不紊的演进. • 单一应用架构 • 当网站流量很小时, ...

  8. Dubbo注册中心的四种配置方式详解

    Dubbo目前支持4种注册中心,(multicast,zookeeper,redis,simple) 推荐使用Zookeeper注册中心. 一.Multicast注册中心 不需要启动任何中心节点,只要 ...

  9. 开发dubbo应用程序(二)dubbo注册中心相关概述

    1.注册中心概述 ​ 在Dubbo微服务体系中,注册中心是其核心组件之一.Dubbo通过注册中心实现了分布式环境中各微服务之间的注册与发现,是各分布式节点之间的纽带.其主要作用如下: 动态加入.一个服 ...

随机推荐

  1. 【Node.js】'readline' 逐行读取、写入文件内容

    [转]运用readline逐行读取的两种实现 效果图如下: 左边1.log 为源文件 右边1.readline.log为复制后的文件 下边为命令行输出 实现方式一: [javascript] view ...

  2. springmvc跨域

    //mvc默认是text/plain;charset=ISO-8859-1@RequestMapping(value = "/xxx", produces = "appl ...

  3. BZOJ3205/UOJ107 [Apio2013]机器人

    本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/ ...

  4. 运行jar_测试代码

    1.Eclipse 将 工程 导出成 jar Eclipse --> Export... --> 界面中树状图形中选择" Java下的'JAR file' "(不知道这 ...

  5. Spark- SparkSQL中 Row.getLong 出现NullPointerException错误的处理方法

    在SparkSQL中获取Row的值,而且Row的字段允许null时,在取值的时候取到null赋值给新的变量名会报NullPointerException错误, 可以先用row.isNullAt(ind ...

  6. selenium学习笔记(智能等待)

    博主在尝试对百度首页用selenium完成自动登录的功能 反复多次尝试元素定位方法也未写错.最后发现问题原因: 脚本运行速度快于页面加载速度 如百度首页登录例子.脚本已经开始寻找登录弹窗 但是页面仍在 ...

  7. ultraedit使用记录

    ultraedit使用记录 10:57:33 在日常的工作中,我经常用keil进行程序的编写等工作,不过在编写过程中Keil对中文的支持不是很好,容易发生问题:同事推荐我用ultraedit进行程序的 ...

  8. 【Hive】执行脚本

    1.linux下执行hive sql脚本 (1)hive -e “sql语句” (2)hive -e “sql语句” >> xxx 将sql查出来的语句重定向到xxx文件中,会显示Ok和数 ...

  9. 【Python系统学习】基础篇

    这次真的是最后一次了!第三次滚Python的基础.走了太多弯路.认真一点!菜鸟! 教程 转义字符 \ 可以转义很多字符,比如\n表示换行,\t表示制表符,字符\本身也要转义,所以\\表示的字符就是\ ...

  10. HTTP浅析

    引言 HTTP是一个属于应用层的面向对象的协议,由于其简捷.快速的方式,适用于分布式超媒体信息系统.它于1990年提出,经过几年的使用与发展,得到不断地完善和扩展.目前在WWW中使用的是HTTP/1. ...