Dubbo入门实例--转载
原文地址:http://blog.csdn.net/ruishenh/article/details/23180707?utm_source=tuicool
1. 概述
Dubbo是一个分布式服务框架,致力于提供高性能和透明化的RPC远程服务调用方案,以及SOA服务治理方案
主要核心部件
Remoting: 网络通信框架,实现了sync-over-async 和 request-response 消息机制.
RPC: 一个远程过程调用的抽象,支持负载均衡、容灾和集群功能
Registry: 服务目录框架用于服务的注册和服务事件发布和订阅。
Dubbo采用全Spring配置方式,透明化接入应用,对应用没有任何API侵入,只需用Spring加载Dubbo的配置即可,Dubbo基于Spring的Schema扩展进行加载。
2. 简单实例
首先maven项目增加dubbo的jar依赖,因为要用到zookeeper注册中心,也要依赖但是要去掉自带的log4j不然会默认的版本依赖jms-1.1.jar jmxtools-1.2.1.jar jmxri-1.2.1.jar等3个包,下载挺麻烦,当然如果个人已经在自己的仓库中有了就无所谓了。
- <!-- dubbo -->
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>dubbo</artifactId>
- <version>2.0.13</version>
- </dependency>
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>3.3.6</version>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.16</version>
- </dependency>
Spring的依赖自己添加就好了
因为要增加zookeeper的注册管理,所以如果有可用的zookeeper就用可用的zookeeper,没有可以按照如下的安装去本地安装一个。
http://blog.csdn.net/ruishenh/article/details/23180355
项目结构图
/gomeTest/src/main/resources/spring/dubbo-provider.xml
- <?xml version="1.0"encoding="UTF-8"?>
- <beansxmlnsbeansxmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://code.alibabatech.com/schema/dubbo
- http://code.alibabatech.com/schema/dubbo/dubbo.xsd
- ">
- <dubbo:applicationnamedubbo:applicationname="hello-world-app" />
- <!--zookeeper注册中心 -->
- <dubbo:registryprotocoldubbo:registryprotocol="zookeeper" address="10.57.41.19:2181" />
- <!--使用multicast广播注册中心暴露服务地址 -->
- <!--<dubbo:registry address="multicast://10.57.41.19:1234" />-->
- <dubbo:protocolnamedubbo:protocolname="dubbo" port="20880" />
- <dubbo:serviceinterfacedubbo:serviceinterface="com.ruishenh.dubbo.example.DemoService"
- ref="demoService"/> <!-- 和本地bean一样实现服务 -->
- <beanidbeanid="demoService"class="com.ruishenh.dubbo.example.DemoServiceImpl" />
- </beans>
/gomeTest/src/main/resources/spring/dubbo-consumer.xml
- <?xml version="1.0"encoding="UTF-8"?>
- <beansxmlnsbeansxmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://code.alibabatech.com/schema/dubbo
- http://code.alibabatech.com/schema/dubbo/dubbo.xsd
- ">
- <!--消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
- <dubbo:applicationnamedubbo:applicationname="consumer-of-helloworld-app" />
- <!--zookeeper注册中心 -->
- <dubbo:registry protocol="zookeeper"address="10.57.41.19:2181" />
- <!--使用multicast广播注册中心暴露的服务地址 -->
- <!--<dubbo:registryaddress="multicast://10.57.41.19:1234" /> -->
- <!-- 生成远程服务代理,可以和本地bean一样使用demoService-->
- <dubbo:referenceiddubbo:referenceid="demoService"interface="com.ruishenh.dubbo.example.DemoService" />
- </beans>
/gomeTest/src/main/java/com/ruishenh/dubbo/example/DemoService.java
- package com.ruishenh.dubbo.example;
- public interface DemoService {
- public voidsayHello();
- public String returnHello();
- public MsgInfo returnMsgInfo(MsgInfo info);
- }
/gomeTest/src/main/java/com/ruishenh/dubbo/example/DemoServiceImpl.java
- package com.ruishenh.dubbo.example;
- public class DemoServiceImpl implements DemoService{
- public void sayHello() {
- System.out.println("hello world!");
- }
- public String returnHello() {
- return "hello world!";
- }
- public MsgInforeturnMsgInfo(MsgInfo info) {
- info.getMsgs().add("处理完毕");
- return info;
- }
- }
/gomeTest/src/main/java/com/ruishenh/dubbo/example/LuncherProvider.java
- package com.ruishenh.dubbo.example;
- importorg.springframework.context.ApplicationContext;
- importorg.springframework.context.support.ClassPathXmlApplicationContext;
- public class LuncherProvider {
- public static void main(String[] args) throws InterruptedException{
- LuncherProviderluncher=new LuncherProvider();
- luncher.start();
- Thread.sleep(1000*60*10);
- }
- void start(){
- String configLocation="spring/dubbo-provider.xml";
- ApplicationContext context =new ClassPathXmlApplicationContext(configLocation);
- String[] names=context.getBeanDefinitionNames();
- System.out.print("Beans:");
- for(String string : names)
- System.out.print(string+",");
- System.out.println();
- }
- }
/gomeTest/src/main/java/com/ruishenh/dubbo/example/LuncherConsumer.java
- package com.ruishenh.dubbo.example;
- import java.util.ArrayList;
- import java.util.List;
- import org.springframework.context.ApplicationContext;
- import org.springframework.context.support.ClassPathXmlApplicationContext;
- public class LuncherConsumer {
- public static void main(String[] args) throws InterruptedException{
- LuncherConsumer luncher=new LuncherConsumer();
- luncher.start();
- }
- void start(){
- String configLocation="spring/dubbo-consumer.xml";
- ApplicationContext context =new ClassPathXmlApplicationContext(configLocation);
- DemoService ds=(DemoService) context.getBean("demoService");
- String[] names=context.getBeanDefinitionNames();
- System.out.print("Beans:");
- for(String string : names) {
- System.out.print(string);
- System.out.print(",");
- }
- System.out.println();
- MsgInfo info =new MsgInfo();
- info.setId(1);
- info.setName("ruisheh");
- List<String> msgs=new ArrayList<String>();
- msgs.add("I");
- msgs.add("am");
- msgs.add("test");
- info.setMsgs(msgs);
- System.out.println(ds.returnMsgInfo(info).getMsgs());
- }
- }
/gomeTest/src/main/java/com/ruishenh/dubbo/example/MsgInfo.java
- package com.ruishenh.dubbo.example;
- import java.io.Serializable;
- import java.util.List;
- public class MsgInfo implementsSerializable {
- privatestatic final long serialVersionUID = -2814022769568306965L;
- intid;
- String name;
- List<String>msgs;
- public int getId() {
- returnid;
- }
- public void setId(int id) {
- this.id= id;
- }
- public String getName() {
- returnname;
- }
- public void setName(String name) {
- this.name= name;
- }
- public List<String> getMsgs() {
- returnmsgs;
- }
- public void setMsgs(List<String> msgs) {
- this.msgs= msgs;
- }
- }
//启动provider
- Refreshingorg.springframework.context.support.ClassPathXmlApplicationContext@42b988a6:startup date [Tue Apr 08 13:43:59 CST 2014]; root of context hierarchy
- Loading XML bean definitions from classpath resource [spring/dubbo-provider.xml]
- using logger:com.alibaba.dubbo.common.logger.support.Log4jLoggerFactory
- Pre-instantiating singletons inorg.springframework.beans.factory.support.DefaultListableBeanFactory@7c2e1f1f:defining beans[hello-world-app,com.alibaba.dubbo.config.RegistryConfig,dubbo,com.ruishenh.dubbo.example.DemoService,demoService];root of factory hierarchy
- [DUBBO] No dubbo.properties found on the class path., dubbo version:2.0.13, current host: 127.0.0.1
- [DUBBO] Export dubbo service com.ruishenh.dubbo.example.DemoService tourldubbo://10.57.41.19:20880/com.ruishenh.dubbo.example.DemoService?anyhost=true&application=hello-world-app&dubbo=2.0.13&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello&prompt=dubbo&revision=,dubbo version: 2.0.13, current host: 127.0.0.1
- [DUBBO] Register dubbo service com.ruishenh.dubbo.example.DemoServiceurl dubbo://10.57.41.19:20880/com.ruishenh.dubbo.example.DemoService?anyhost=true&application=hello-world-app&dubbo=2.0.13&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello&prompt=dubbo&revision=to registry registry://10.57.41.19:2181/com.alibaba.dubbo.registry.RegistryService?application=hello-world-app®istry=zookeeper,dubbo version: 2.0.13, current host: 127.0.0.1
- [DUBBO] Start NettyServer bind /0.0.0.0:20880, export/10.57.41.19:20880, dubbo version: 2.0.13, current host: 127.0.0.1
- Client environment:zookeeper.version=3.3.6-1366786,built on 07/29/2012 06:22 GMT
- Clientenvironment:host.name=houchangren.ds.gome.com.cn
- Client environment:java.version=1.6.0_26
- Client environment:java.vendor=SunMicrosystems Inc.
- Clientenvironment:java.home=D:\application\Java\jdk1.6.0_26\jre
- Clientenvironment:java.class.path=D:\workspace\20140326\gomeTest\target\classes;D:\jar\jars\jai_imageio-1.1-alpha.jar;D:\jar\jars\rocketmq\rocketmq-broker-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-client-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-common-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-example-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-namesrv-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-remoting-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-research-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-store-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-tools-3.0.8.jar;D:\repository\commons-httpclient\commons-httpclient\3.1\commons-httpclient-3.1.jar;D:\repository\commons-logging\commons-logging\1.0.4\commons-logging-1.0.4.jar;D:\repository\commons-codec\commons-codec\1.2\commons-codec-1.2.jar;D:\repository\org\apache\httpcomponents\httpclient\4.2.3\httpclient-4.2.3.jar;D:\repository\org\apache\httpcomponents\httpcore\4.2.3\httpcore-4.2.3.jar;D:\repository\org\apache\httpcomponents\httpmime\4.2.3\httpmime-4.2.3.jar;D:\repository\ch\qos\logback\logback-classic\1.1.1\logback-classic-1.1.1.jar;D:\repository\org\slf4j\slf4j-api\1.7.6\slf4j-api-1.7.6.jar;D:\repository\ch\qos\logback\logback-core\1.1.1\logback-core-1.1.1.jar;D:\repository\org\swinglabs\swingx\1.6.1\swingx-1.6.1.jar;D:\repository\com\jhlabs\filters\2.0.235\filters-2.0.235.jar;D:\repository\org\swinglabs\swing-worker\1.1\swing-worker-1.1.jar;D:\repository\redis\clients\jedis\2.4.2\jedis-2.4.2.jar;D:\repository\org\apache\commons\commons-pool2\2.0\commons-pool2-2.0.jar;D:\repository\org\springframework\spring-webmvc\3.1.0.RELEASE\spring-webmvc-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-asm\3.1.0.RELEASE\spring-asm-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-context-support\3.1.0.RELEASE\spring-context-support-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-web\3.1.0.RELEASE\spring-web-3.1.0.RELEASE.jar;D:\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\repository\org\springframework\spring-test\3.1.0.RELEASE\spring-test-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-expression\3.1.0.RELEASE\spring-expression-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-tx\3.1.0.RELEASE\spring-tx-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-aop\3.1.0.RELEASE\spring-aop-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-beans\3.1.0.RELEASE\spring-beans-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-core\3.1.0.RELEASE\spring-core-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-context\3.1.0.RELEASE\spring-context-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-jdbc\3.1.0.RELEASE\spring-jdbc-3.1.0.RELEASE.jar;D:\repository\org\quartz-scheduler\quartz\1.7.2\quartz-1.7.2.jar;D:\repository\com\alibaba\dubbo\2.0.13\dubbo-2.0.13.jar;D:\repository\org\springframework\spring\2.5.6.SEC03\spring-2.5.6.SEC03.jar;D:\repository\org\javassist\javassist\3.15.0-GA\javassist-3.15.0-GA.jar;D:\repository\org\jboss\netty\netty\3.2.5.Final\netty-3.2.5.Final.jar;D:\repository\org\apache\zookeeper\zookeeper\3.3.6\zookeeper-3.3.6.jar;D:\repository\jline\jline\0.9.94\jline-0.9.94.jar;D:\repository\log4j\log4j\1.2.16\log4j-1.2.16.jar;D:\repository\org\codehaus\jackson\jackson-core-asl\1.8.4\jackson-core-asl-1.8.4.jar;D:\repository\org\codehaus\jackson\jackson-mapper-asl\1.8.4\jackson-mapper-asl-1.8.4.jar;D:\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;D:\repository\javax\servlet\jsp-api\2.0\jsp-api-2.0.jar
- Client environment:java.library.path=D:\application\Java\jdk1.6.0_26\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramFiles (x86)\NVIDIACorporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\application\Java\jdk1.6.0_26\bin;D:\application\apache-maven-3.1.0\bin;D:\application\TortoiseSVN\bin;D:\application\SlikSvn\bin;D:\application\Java\jdk1.6.0_26\lib;C:\ProgramFiles (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\application\Java\jdk1.6.0_26\bin;D:\application\apache-maven-3.1.0\bin;D:\application\TortoiseSVN\bin;D:\application\SlikSvn\bin;D:\application\Java\jdk1.6.0_26\lib;;D:\application\IDMComputerSolutions\UltraEdit\;D:\application\Java\jdk1.6.0_26\bin;D:\application\Java\jdk1.6.0_26\jre\bin;.
- Clientenvironment:java.io.tmpdir=C:\Users\HOUCHA~1\AppData\Local\Temp\
- Clientenvironment:java.compiler=<NA>
- Client environment:os.name=Windows 7
- Client environment:os.arch=amd64
- Client environment:os.version=6.1
- Client environment:user.name=houchangren
- Clientenvironment:user.home=C:\Users\houchangren
- Clientenvironment:user.dir=D:\workspace\20140326\gomeTest
- Initiating client connection,connectString=10.57.41.19:2181 sessionTimeout=60000watcher=com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry$1@a3468f4
- Opening socket connection to server/10.57.41.19:2181
- [DUBBO] Register: dubbo://10.57.41.19:20880/com.ruishenh.dubbo.example.DemoService?anyhost=true&application=hello-world-app&dubbo=2.0.13&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello&prompt=dubbo&revision=,dubbo version: 2.0.13, current host: 127.0.0.1
- Socket connection established tohouchangren.ds.gome.com.cn/10.57.41.19:2181, initiating session
- Session establishment complete on serverhouchangren.ds.gome.com.cn/10.57.41.19:2181, sessionid = 0x1453fd17c750004,negotiated timeout = 40000
- [DUBBO] Recover register services[dubbo://10.57.41.19:20880/com.ruishenh.dubbo.example.DemoService?anyhost=true&application=hello-world-app&dubbo=2.0.13&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello&prompt=dubbo&revision=],dubbo version: 2.0.13, current host: 127.0.0.1
- [DUBBO] Register:dubbo://10.57.41.19:20880/com.ruishenh.dubbo.example.DemoService?anyhost=true&application=hello-world-app&dubbo=2.0.13&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello&prompt=dubbo&revision=,dubbo version: 2.0.13, current host: 127.0.0.1
Beans:hello-world-app,com.alibaba.dubbo.config.RegistryConfig,dubbo,com.ruishenh.dubbo.example.DemoService,demoService,
//这两句是在有consumer执行后的日志
- [DUBBO] All clients has discontected from /10.57.41.19:20880. You cangraceful shutdown now., dubbo version: 2.0.13, current host: 127.0.0.1
- [DUBBO] disconected from/10.57.41.19:58330,url:dubbo://10.57.41.19:20880/com.ruishenh.dubbo.example.DemoService?anyhost=true&application=hello-world-app&channel.readonly.sent=true&codec=dubbo&codec.downstream=dubbo&dubbo=2.0.13&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello&prompt=dubbo&revision=,dubbo version: 2.0.13, current host: 127.0.0.1
//启动Consumer
- Refreshingorg.springframework.context.support.ClassPathXmlApplicationContext@42b988a6:startup date [Tue Apr 08 13:45:09 CST 2014]; root of context hierarchy
- Loading XML bean definitions from classpath resource [spring/dubbo-consumer.xml]
- using logger:com.alibaba.dubbo.common.logger.support.Log4jLoggerFactory
- Pre-instantiating singletons inorg.springframework.beans.factory.support.DefaultListableBeanFactory@250d593e:defining beans[consumer-of-helloworld-app,com.alibaba.dubbo.config.RegistryConfig,demoService];root of factory hierarchy
- [DUBBO] No dubbo.properties found on the class path., dubbo version:2.0.13, current host: 127.0.0.1
- Client environment:zookeeper.version=3.3.6-1366786,built on 07/29/2012 06:22 GMT
- Clientenvironment:host.name=houchangren.ds.gome.com.cn
- Client environment:java.version=1.6.0_26
- Client environment:java.vendor=SunMicrosystems Inc.
- Client environment:java.home=D:\application\Java\jdk1.6.0_26\jre
- Clientenvironment:java.class.path=D:\workspace\20140326\gomeTest\target\classes;D:\jar\jars\jai_imageio-1.1-alpha.jar;D:\jar\jars\rocketmq\rocketmq-broker-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-client-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-common-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-example-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-namesrv-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-remoting-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-research-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-store-3.0.8.jar;D:\jar\jars\rocketmq\rocketmq-tools-3.0.8.jar;D:\repository\commons-httpclient\commons-httpclient\3.1\commons-httpclient-3.1.jar;D:\repository\commons-logging\commons-logging\1.0.4\commons-logging-1.0.4.jar;D:\repository\commons-codec\commons-codec\1.2\commons-codec-1.2.jar;D:\repository\org\apache\httpcomponents\httpclient\4.2.3\httpclient-4.2.3.jar;D:\repository\org\apache\httpcomponents\httpcore\4.2.3\httpcore-4.2.3.jar;D:\repository\org\apache\httpcomponents\httpmime\4.2.3\httpmime-4.2.3.jar;D:\repository\ch\qos\logback\logback-classic\1.1.1\logback-classic-1.1.1.jar;D:\repository\org\slf4j\slf4j-api\1.7.6\slf4j-api-1.7.6.jar;D:\repository\ch\qos\logback\logback-core\1.1.1\logback-core-1.1.1.jar;D:\repository\org\swinglabs\swingx\1.6.1\swingx-1.6.1.jar;D:\repository\com\jhlabs\filters\2.0.235\filters-2.0.235.jar;D:\repository\org\swinglabs\swing-worker\1.1\swing-worker-1.1.jar;D:\repository\redis\clients\jedis\2.4.2\jedis-2.4.2.jar;D:\repository\org\apache\commons\commons-pool2\2.0\commons-pool2-2.0.jar;D:\repository\org\springframework\spring-webmvc\3.1.0.RELEASE\spring-webmvc-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-asm\3.1.0.RELEASE\spring-asm-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-context-support\3.1.0.RELEASE\spring-context-support-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-web\3.1.0.RELEASE\spring-web-3.1.0.RELEASE.jar;D:\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\repository\org\springframework\spring-test\3.1.0.RELEASE\spring-test-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-expression\3.1.0.RELEASE\spring-expression-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-tx\3.1.0.RELEASE\spring-tx-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-aop\3.1.0.RELEASE\spring-aop-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-beans\3.1.0.RELEASE\spring-beans-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-core\3.1.0.RELEASE\spring-core-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-context\3.1.0.RELEASE\spring-context-3.1.0.RELEASE.jar;D:\repository\org\springframework\spring-jdbc\3.1.0.RELEASE\spring-jdbc-3.1.0.RELEASE.jar;D:\repository\org\quartz-scheduler\quartz\1.7.2\quartz-1.7.2.jar;D:\repository\com\alibaba\dubbo\2.0.13\dubbo-2.0.13.jar;D:\repository\org\springframework\spring\2.5.6.SEC03\spring-2.5.6.SEC03.jar;D:\repository\org\javassist\javassist\3.15.0-GA\javassist-3.15.0-GA.jar;D:\repository\org\jboss\netty\netty\3.2.5.Final\netty-3.2.5.Final.jar;D:\repository\org\apache\zookeeper\zookeeper\3.3.6\zookeeper-3.3.6.jar;D:\repository\jline\jline\0.9.94\jline-0.9.94.jar;D:\repository\log4j\log4j\1.2.16\log4j-1.2.16.jar;D:\repository\org\codehaus\jackson\jackson-core-asl\1.8.4\jackson-core-asl-1.8.4.jar;D:\repository\org\codehaus\jackson\jackson-mapper-asl\1.8.4\jackson-mapper-asl-1.8.4.jar;D:\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;D:\repository\javax\servlet\jsp-api\2.0\jsp-api-2.0.jar
- Clientenvironment:java.library.path=D:\application\Java\jdk1.6.0_26\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramFiles (x86)\NVIDIACorporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\application\Java\jdk1.6.0_26\bin;D:\application\apache-maven-3.1.0\bin;D:\application\TortoiseSVN\bin;D:\application\SlikSvn\bin;D:\application\Java\jdk1.6.0_26\lib;C:\ProgramFiles (x86)\NVIDIACorporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\application\Java\jdk1.6.0_26\bin;D:\application\apache-maven-3.1.0\bin;D:\application\TortoiseSVN\bin;D:\application\SlikSvn\bin;D:\application\Java\jdk1.6.0_26\lib;;D:\application\IDMComputer Solutions\UltraEdit\;D:\application\Java\jdk1.6.0_26\bin;D:\application\Java\jdk1.6.0_26\jre\bin;.
- Clientenvironment:java.io.tmpdir=C:\Users\HOUCHA~1\AppData\Local\Temp\
- Clientenvironment:java.compiler=<NA>
- Client environment:os.name=Windows 7
- Client environment:os.arch=amd64
- Client environment:os.version=6.1
- Client environment:user.name=houchangren
- Clientenvironment:user.home=C:\Users\houchangren
- Clientenvironment:user.dir=D:\workspace\20140326\gomeTest
- Initiating client connection,connectString=10.57.41.19:2181 sessionTimeout=60000watcher=com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry$1@219ba640
- Opening socket connection to server/10.57.41.19:2181
- Socket connection established to houchangren.ds.gome.com.cn/10.57.41.19:2181,initiating session
- [DUBBO] Subscribe:subscribe://10.57.41.19/com.ruishenh.dubbo.example.DemoService?application=consumer-of-helloworld-app&dubbo=2.0.13&id=demoService&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello,dubbo version: 2.0.13, current host: 10.57.41.19
- [DUBBO] Register:subscribe://10.57.41.19/com.ruishenh.dubbo.example.DemoService?application=consumer-of-helloworld-app&dubbo=2.0.13&id=demoService&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello,dubbo version: 2.0.13, current host: 10.57.41.19
- Session establishment complete on serverhouchangren.ds.gome.com.cn/10.57.41.19:2181, sessionid = 0x1453fd17c750005,negotiated timeout = 40000
- [DUBBO] Recover register services[subscribe://10.57.41.19/com.ruishenh.dubbo.example.DemoService?application=consumer-of-helloworld-app&dubbo=2.0.13&id=demoService&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello],dubbo version: 2.0.13, current host: 10.57.41.19
- [DUBBO] Register:subscribe://10.57.41.19/com.ruishenh.dubbo.example.DemoService?application=consumer-of-helloworld-app&dubbo=2.0.13&id=demoService&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello,dubbo version: 2.0.13, current host: 10.57.41.19
- [DUBBO] Start NettyClient houchangren/10.57.41.19 connect to the server/10.57.41.19:20880, dubbo version: 2.0.13, current host: 10.57.41.19
- [DUBBO] Recover subscribe services{subscribe://10.57.41.19/com.ruishenh.dubbo.example.DemoService?application=consumer-of-helloworld-app&dubbo=2.0.13&id=demoService&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello=[com.alibaba.dubbo.registry.support.RegistryDirectory@57922f46]},dubbo version: 2.0.13, current host: 10.57.41.19
- [DUBBO] Subscribe:subscribe://10.57.41.19/com.ruishenh.dubbo.example.DemoService?application=consumer-of-helloworld-app&dubbo=2.0.13&id=demoService&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello,dubbo version: 2.0.13, current host: 10.57.41.19
- [DUBBO] Register:subscribe://10.57.41.19/com.ruishenh.dubbo.example.DemoService?application=consumer-of-helloworld-app&dubbo=2.0.13&id=demoService&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello,dubbo version: 2.0.13, current host: 10.57.41.19
- [DUBBO] Refer dubbo service com.ruishenh.dubbo.example.DemoService fromurlzookeeper://10.57.41.19:2181/com.alibaba.dubbo.registry.RegistryService?anyhost=true&application=consumer-of-helloworld-app&dubbo=2.0.13&id=demoService&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello&prompt=dubbo&revision=,dubbo version: 2.0.13, current host: 10.57.41.19
Beans:consumer-of-helloworld-app,com.alibaba.dubbo.config.RegistryConfig,demoService,
[I, am, test, 处理完毕]
- [DUBBO] Run shutdown hook now., dubbo version: 2.0.13, current host:10.57.41.19
- [DUBBO] Close all registries[zookeeper://10.57.41.19:2181/com.alibaba.dubbo.registry.RegistryService?application=consumer-of-helloworld-app&refer=application%3Dconsumer-of-helloworld-app%26dubbo%3D2.0.13%26id%3DdemoService%26interface%3Dcom.ruishenh.dubbo.example.DemoService%26methods%3DreturnMsgInfo%2CreturnHello%2CsayHello],dubbo version: 2.0.13, current host: 10.57.41.19
- [DUBBO] Destroy registry:zookeeper://10.57.41.19:2181/com.alibaba.dubbo.registry.RegistryService?application=consumer-of-helloworld-app&refer=application%3Dconsumer-of-helloworld-app%26dubbo%3D2.0.13%26id%3DdemoService%26interface%3Dcom.ruishenh.dubbo.example.DemoService%26methods%3DreturnMsgInfo%2CreturnHello%2CsayHello,dubbo version: 2.0.13, current host: 10.57.41.19
- [DUBBO] Unregister:subscribe://10.57.41.19/com.ruishenh.dubbo.example.DemoService?application=consumer-of-helloworld-app&dubbo=2.0.13&id=demoService&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello,dubbo version: 2.0.13, current host: 10.57.41.19
- Session: 0x1453fd17c750005 closed
- EventThread shut down
- [DUBBO] Destroy reference:dubbo://10.57.41.19:20880/com.ruishenh.dubbo.example.DemoService?anyhost=true&application=consumer-of-helloworld-app&check=false&dubbo=2.0.13&id=demoService&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello&prompt=dubbo&revision=,dubbo version: 2.0.13, current host: 10.57.41.19
- [DUBBO] Close netty channel [id: 0x3fdb484d, /10.57.41.19:58314 =>/10.57.41.19:20880], dubbo version: 2.0.13, current host: 10.57.41.19
- [DUBBO] disconected from/10.57.41.19:20880,url:dubbo://10.57.41.19:20880/com.ruishenh.dubbo.example.DemoService?anyhost=true&application=consumer-of-helloworld-app&check=false&codec=dubbo&dubbo=2.0.13&id=demoService&interface=com.ruishenh.dubbo.example.DemoService&methods=returnMsgInfo,returnHello,sayHello&prompt=dubbo&revision=,dubbo version: 2.0.13, current host: 10.57.41.19
- [DUBBO] Close dubbo connect: 10.57.41.19:0-->10.57.41.19:20880, dubboversion: 2.0.13, current host: 10.57.41.19
- [DUBBO] Close dubbo connect: 10.57.41.19:0-->10.57.41.19:20880, dubboversion: 2.0.13, current host: 10.57.41.19
Dubbo入门实例--转载的更多相关文章
- Dubbo入门实例 本地伪集群测试Demo
1. 概述 Dubbo是一个分布式服务框架,致力于提供高性能和透明化的RPC远程服务调用方案,以及SOA服务治理方案 Dubbo是阿里巴巴SOA服务化治理方案的核心框架,每天为2,000+个服务提 ...
- docker入门实例(转载)
1.Docker 是什么?Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的镜像中,然后发布到任何流行的 Linux 或 Windows 机器上( 摘自百度 ) ...
- 分布式服务框架dubbo入门实例
dubbo是一个分布式的服务架构,可直接用于生产环境作为SOA服务框架. 官网首页:http://dubbo.io/ ,官方用户指南 http://dubbo.io/User+Guide-zh.htm ...
- 简单易懂dubbo入门实例
一.创建Maven多模块项目 项目结构如下 模块介绍: dubbo-api ----API接口 dubbo-consumer ----消费者 dubbo-provider ...
- React 入门实例教程(转载)
本人转载自: React 入门实例教程
- 转载 SpringMVC详解(三)------基于注解的入门实例
目录 1.在 web.xml 文件中配置前端处理器 2.在 springmvc.xml 文件中配置处理器映射器,处理器适配器,视图解析器 3.编写 Handler 4.编写 视图 index.jsp ...
- Node.js入门实例程序
在使用Node.js创建实际“Hello, World!”应用程序之前,让我们看看Node.js的应用程序的部分.Node.js应用程序由以下三个重要组成部分: 导入需要模块: 我们使用require ...
- Asp.Net MVC2.0 Url 路由入门---实例篇
本篇主要讲述Routing组件的作用,以及举几个实例来学习Asp.Net MVC2.0 Url路由技术. 接着上一篇开始讲,我们在Global.asax中注册一条路由后,我们的请求是怎么转到相应的Vi ...
- Spark+ECLIPSE+JAVA+MAVEN windows开发环境搭建及入门实例【附详细代码】
http://blog.csdn.net/xiefu5hh/article/details/51707529 Spark+ECLIPSE+JAVA+MAVEN windows开发环境搭建及入门实例[附 ...
随机推荐
- POJ 3111
K Best Time Limit: 8000MS Memory Limit: 65536K Total Submissions: 5177 Accepted: 1411 Case Time ...
- MySQL 语句级避免重复插入—— Insert Select Not Exist
想要插入一条数据,要避免重复插入,又不想折腾两回数据库连接操作,可以参考如下办法. INSERT INTO table(column1,column2,column3 ...columnN) SELE ...
- [DLX]HDOJ4069 Squiggly Sudoku
题意:有9*9的格子 每个格子 由五部分组成:上(16).右(32).下(64).左(128).和该格的数值(0~9) 若上下左右有分割格子的线 就加上相应的数, 该格的数值若为0,则是未知 1~9 ...
- lintcode :Remove Duplicates from Sorted Array 删除排序数组中的重复数字
题目: 删除排序数组中的重复数字 给定一个排序数组,在原数组中删除重复出现的数字,使得每个元素只出现一次,并且返回新的数组的长度. 不要使用额外的数组空间,必须在原地没有额外空间的条件下完成. 样例 ...
- *[codility]Country network
https://codility.com/programmers/challenges/fluorum2014 http://www.51nod.com/onlineJudge/questionCod ...
- 为什么需要用到序列化?为什么HttpSession中对象要序列化
简单说就是为了保存在内存中的各种对象的状态,并且可以把保存的对象状态再读出来.虽然你可以用你自己的各种各样的方法来保存Object States,但是Java给你提供一种应该比你自己好的保存对象状态的 ...
- linux 线程的内核栈是独立的还是共享父进程的?
需要考证 考证结果: 其内核栈是独立的 206 static struct task_struct *dup_task_struct(struct task_struct *orig) 207 { 2 ...
- android休眠唤醒流程2
android系统一段时间没有操作, 屏幕(screen)将从高亮(bright)变为暗淡(dim),如果再过段时间还是没有操作,屏幕(screen)从暗淡(dim)变为关闭(off).这时,系 ...
- linux查看硬件环境
一:查看cpu more /proc/cpuinfo | grep "model name" grep "model name" /proc/cpuinfo 如 ...
- ActiveMQ之消息指针
消息指针(Message cursor)是activeMQ里一个非常重要的核心类,它是提供某种优化消息存储的方法.消息中间件的实现一般都是当消费者准备好消费消息的时候,它会从持久化存储中一批一批的读取 ...