dubbo2.7.3学习(一)

  • Post author:
  • Post category:其他



dobbo官网:

https://dubbo.apache.org/zh-cn/docs/user/quick-start.html


github官网:

https://github.com/apache/dubbo


一、创建公共依赖dubbo-dependencies


1. 创建工程dubbo-dependencies,pom.xml文件如下

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.zsx</groupId>
    <artifactId>dubbo-dependencies</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>

    <name>dubbo-dependencies</name>
    <description>Dubbo Dependencies</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>11</java.version>
        <dubbo.version>2.7.3</dubbo.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.dubbo</groupId>
                <artifactId>dubbo-dependencies-bom</artifactId>
                <version>${dubbo.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo</artifactId>
            <version>${dubbo.version}</version>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
        </dependency>
    </dependencies>

</project>

二、创建公共接口


1. 创建工程


dubbo-interface,pom.xml文件如下

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.zsx</groupId>
    <artifactId>dubbo-interface</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>dubbo-interface</name>
    <description>Dubbo Interface</description>

</project>


2.  编写公共服务接口类

package com.zsx.service;

public interface UserService {

    String get(String msg);
}

三、创建服务提供者


1. 创建工程dubbo-provide,pom.xml文件如下

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.zsx</groupId>
    <artifactId>dubbo-provider</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>dubbo-provider</name>
    <description>Dubbo Provider</description>

    <properties>
        <dubbo-interface.version>0.0.1-SNAPSHOT</dubbo-interface.version>
        <curator.version>4.2.0</curator.version>
        <zookeeper.version>3.5.5</zookeeper.version>
        <javassist.version>3.25.0-GA</javassist.version>
        <dubbo-registry-redis.version>2.7.3</dubbo-registry-redis.version>
    </properties>
    <parent>
        <groupId>com.zsx</groupId>
        <artifactId>dubbo-dependencies</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <relativePath>../dubbo-dependencies/pom.xml</relativePath>
    </parent>

    <dependencies>
        <dependency>
            <groupId>com.zsx</groupId>
            <artifactId>dubbo-interface</artifactId>
            <version>${dubbo-interface.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
            <version>${zookeeper.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-framework</artifactId>
            <version>${curator.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-recipes</artifactId>
            <version>${curator.version}</version>
        </dependency>
        <!--<dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-client</artifactId>
            <version>${curator.version}</version>
        </dependency>-->
        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-registry-redis</artifactId>
            <version>${dubbo-registry-redis.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


2. 编写配置文件src/main/resource/com/zsx/dubbo-provider.xml

<?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://dubbo.apache.org/schema/dubbo"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
       http://dubbo.apache.org/schema/dubbo
       http://dubbo.apache.org/schema/dubbo/dubbo.xsd">

    <!-- 提供方应用信息,用于计算依赖关系 -->
    <dubbo:application name="provider-server"/>

    <!-- 配置中心 -->
    <dubbo:config-center address="zookeeper://127.0.0.1:2181" />
    <!-- 使用zookeeper注册中心暴露服务地址 -->
    <dubbo:registry address="zookeeper://127.0.0.1:2181" simplified="true" />

    <!--<dubbo:metadata-report address="redis://127.0.0.1:6379" />-->

    <!-- 用dubbo协议在20880端口暴露服务 -->
    <dubbo:protocol name="dubbo" port="20880"/>

    <!-- 和本地bean一样实现服务 -->
    <bean id="userService" class="com.zsx.service.impl.UserServiceImpl" />

    <!-- 声明需要暴露的服务接口 -->
    <dubbo:service interface="com.zsx.service.UserService" ref="userService" />

</beans>


3. 编写日志文件src/main/resources/log4j.properties

###set log levels###
log4j.rootLogger=info, stdout
###output to console###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy HH:mm:ss:SSS z}] %t %5p %c{2}: %m%n


4. 编写src/main/resources/dubbo.properties配置文件

dubbo.application.qos.port=22222


5. 创建接口对应的实现

package com.zsx.service.impl;

import com.zsx.service.UserService;
import org.apache.dubbo.rpc.RpcContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class UserServiceImpl implements UserService {

    private static final Logger LOGGER = LoggerFactory.getLogger(UserServiceImpl.class);

    @Override
    public String get(String msg) {
        LOGGER.info("The message content is : %s, Service address is : %s", msg, RpcContext.getContext().getLocalAddress());
        return String.format("The message content is : %s, Service address is : %s", msg, RpcContext.getContext().getLocalAddress());
    }
}


6. 创建主程序启动类

package com.zsx;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.io.IOException;

public class ProviderApplication {

    public static void main(String[] args) throws IOException {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"com/zsx/dubbo-provider.xml"});
        context.start();
        System.in.read(); // 按任意键退出
    }
}


7. 启动服务提供者

C:\software\jdk-11.0.3\bin\java.exe "-javaagent:C:\software\JetBrains\IntelliJ IDEA 2019.1.3\lib\idea_rt.jar=2350:C:\software\JetBrains\IntelliJ IDEA 2019.1.3\bin" -Dfile.encoding=UTF-8 -classpath F:\IdeaProjects\dubbo\dubbo-provider\target\classes;F:\IdeaProjects\dubbo\dubbo-interface\target\classes;D:\repository\org\apache\zookeeper\zookeeper\3.5.5\zookeeper-3.5.5.jar;D:\repository\org\apache\zookeeper\zookeeper-jute\3.5.5\zookeeper-jute-3.5.5.jar;D:\repository\org\apache\yetus\audience-annotations\0.5.0\audience-annotations-0.5.0.jar;D:\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\repository\org\slf4j\slf4j-log4j12\1.7.25\slf4j-log4j12-1.7.25.jar;D:\repository\log4j\log4j\1.2.16\log4j-1.2.16.jar;D:\repository\org\apache\curator\curator-framework\4.2.0\curator-framework-4.2.0.jar;D:\repository\org\apache\curator\curator-client\4.2.0\curator-client-4.2.0.jar;D:\repository\com\google\guava\guava\27.0.1-jre\guava-27.0.1-jre.jar;D:\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;D:\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;D:\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;D:\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar;D:\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar;D:\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;D:\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar;D:\repository\org\apache\curator\curator-recipes\4.2.0\curator-recipes-4.2.0.jar;D:\repository\org\apache\dubbo\dubbo-registry-redis\2.7.3\dubbo-registry-redis-2.7.3.jar;D:\repository\org\apache\dubbo\dubbo-registry-api\2.7.3\dubbo-registry-api-2.7.3.jar;D:\repository\org\apache\dubbo\dubbo-cluster\2.7.3\dubbo-cluster-2.7.3.jar;D:\repository\org\apache\dubbo\dubbo-rpc-api\2.7.3\dubbo-rpc-api-2.7.3.jar;D:\repository\org\apache\dubbo\dubbo-serialization-api\2.7.3\dubbo-serialization-api-2.7.3.jar;D:\repository\org\apache\dubbo\dubbo-remoting-api\2.7.3\dubbo-remoting-api-2.7.3.jar;D:\repository\org\apache\dubbo\dubbo-configcenter-api\2.7.3\dubbo-configcenter-api-2.7.3.jar;D:\repository\org\apache\dubbo\dubbo-common\2.7.3\dubbo-common-2.7.3.jar;D:\repository\com\alibaba\hessian-lite\3.2.5\hessian-lite-3.2.5.jar;D:\repository\com\alibaba\fastjson\1.2.46\fastjson-1.2.46.jar;D:\repository\com\esotericsoftware\kryo\4.0.1\kryo-4.0.1.jar;D:\repository\com\esotericsoftware\reflectasm\1.11.3\reflectasm-1.11.3.jar;D:\repository\org\ow2\asm\asm\5.0.4\asm-5.0.4.jar;D:\repository\com\esotericsoftware\minlog\1.3.0\minlog-1.3.0.jar;D:\repository\org\objenesis\objenesis\2.5.1\objenesis-2.5.1.jar;D:\repository\de\javakaffee\kryo-serializers\0.42\kryo-serializers-0.42.jar;D:\repository\de\ruedigermoeller\fst\2.48-jdk-6\fst-2.48-jdk-6.jar;D:\repository\com\fasterxml\jackson\core\jackson-core\2.8.6\jackson-core-2.8.6.jar;D:\repository\com\cedarsoftware\java-util\1.9.0\java-util-1.9.0.jar;D:\repository\com\cedarsoftware\json-io\2.5.1\json-io-2.5.1.jar;D:\repository\org\apache\dubbo\dubbo-container-api\2.7.3\dubbo-container-api-2.7.3.jar;D:\repository\redis\clients\jedis\2.9.0\jedis-2.9.0.jar;D:\repository\org\apache\commons\commons-pool2\2.4.2\commons-pool2-2.4.2.jar;D:\repository\org\apache\dubbo\dubbo\2.7.3\dubbo-2.7.3.jar;D:\repository\org\springframework\spring-context\4.3.16.RELEASE\spring-context-4.3.16.RELEASE.jar;D:\repository\org\springframework\spring-aop\4.3.16.RELEASE\spring-aop-4.3.16.RELEASE.jar;D:\repository\org\springframework\spring-beans\4.3.16.RELEASE\spring-beans-4.3.16.RELEASE.jar;D:\repository\org\springframework\spring-core\4.3.16.RELEASE\spring-core-4.3.16.RELEASE.jar;D:\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\repository\org\springframework\spring-expression\4.3.16.RELEASE\spring-expression-4.3.16.RELEASE.jar;D:\repository\org\javassist\javassist\3.20.0-GA\javassist-3.20.0-GA.jar;D:\repository\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar;D:\repository\org\yaml\snakeyaml\1.20\snakeyaml-1.20.jar;D:\repository\io\netty\netty-all\4.1.25.Final\netty-all-4.1.25.Final.jar com.zsx.ProviderApplication
[12/09/19 10:43:48:151 CST] main  INFO support.ClassPathXmlApplicationContext: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@641147d0: startup date [Thu Sep 12 10:43:48 CST 2019]; root of context hierarchy
[12/09/19 10:43:48:193 CST] main  INFO xml.XmlBeanDefinitionReader: Loading XML bean definitions from class path resource [com/zsx/dubbo-provider.xml]
[12/09/19 10:43:48:327 CST] main  INFO logger.LoggerFactory: using logger: org.apache.dubbo.common.logger.log4j.Log4jLoggerAdapter
[12/09/19 10:43:48:340 CST] main ERROR common.Version:  [DUBBO] Duplicate class org/apache/dubbo/common/Version.class in 2 jar [file:/D:/repository/org/apache/dubbo/dubbo-common/2.7.3/dubbo-common-2.7.3.jar!/org/apache/dubbo/common/Version.class, file:/D:/repository/org/apache/dubbo/dubbo/2.7.3/dubbo-2.7.3.jar!/org/apache/dubbo/common/Version.class], dubbo version: 2.7.3, current host: 192.168.56.1
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by javassist.ClassPool (file:/D:/repository/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of javassist.ClassPool
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[12/09/19 10:43:48:620 CST] main  INFO config.AbstractConfig:  [DUBBO] The service ready on spring started. service: com.zsx.service.UserService, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:57:711 CST] main  INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.5.5-390fe37ea45dee01bf87dc1c042b5e3dcce88653, built on 05/03/2019 12:07 GMT
[12/09/19 10:43:57:712 CST] main  INFO zookeeper.ZooKeeper: Client environment:host.name=zsx
[12/09/19 10:43:57:712 CST] main  INFO zookeeper.ZooKeeper: Client environment:java.version=11.0.3
[12/09/19 10:43:57:712 CST] main  INFO zookeeper.ZooKeeper: Client environment:java.vendor=Oracle Corporation
[12/09/19 10:43:57:712 CST] main  INFO zookeeper.ZooKeeper: Client environment:java.home=C:\software\jdk-11.0.3
[12/09/19 10:43:57:713 CST] main  INFO zookeeper.ZooKeeper: Client environment:java.class.path=F:\IdeaProjects\dubbo\dubbo-provider\target\classes;F:\IdeaProjects\dubbo\dubbo-interface\target\classes;D:\repository\org\apache\zookeeper\zookeeper\3.5.5\zookeeper-3.5.5.jar;D:\repository\org\apache\zookeeper\zookeeper-jute\3.5.5\zookeeper-jute-3.5.5.jar;D:\repository\org\apache\yetus\audience-annotations\0.5.0\audience-annotations-0.5.0.jar;D:\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\repository\org\slf4j\slf4j-log4j12\1.7.25\slf4j-log4j12-1.7.25.jar;D:\repository\log4j\log4j\1.2.16\log4j-1.2.16.jar;D:\repository\org\apache\curator\curator-framework\4.2.0\curator-framework-4.2.0.jar;D:\repository\org\apache\curator\curator-client\4.2.0\curator-client-4.2.0.jar;D:\repository\com\google\guava\guava\27.0.1-jre\guava-27.0.1-jre.jar;D:\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;D:\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;D:\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;D:\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar;D:\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar;D:\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;D:\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar;D:\repository\org\apache\curator\curator-recipes\4.2.0\curator-recipes-4.2.0.jar;D:\repository\org\apache\dubbo\dubbo-registry-redis\2.7.3\dubbo-registry-redis-2.7.3.jar;D:\repository\org\apache\dubbo\dubbo-registry-api\2.7.3\dubbo-registry-api-2.7.3.jar;D:\repository\org\apache\dubbo\dubbo-cluster\2.7.3\dubbo-cluster-2.7.3.jar;D:\repository\org\apache\dubbo\dubbo-rpc-api\2.7.3\dubbo-rpc-api-2.7.3.jar;D:\repository\org\apache\dubbo\dubbo-serialization-api\2.7.3\dubbo-serialization-api-2.7.3.jar;D:\repository\org\apache\dubbo\dubbo-remoting-api\2.7.3\dubbo-remoting-api-2.7.3.jar;D:\repository\org\apache\dubbo\dubbo-configcenter-api\2.7.3\dubbo-configcenter-api-2.7.3.jar;D:\repository\org\apache\dubbo\dubbo-common\2.7.3\dubbo-common-2.7.3.jar;D:\repository\com\alibaba\hessian-lite\3.2.5\hessian-lite-3.2.5.jar;D:\repository\com\alibaba\fastjson\1.2.46\fastjson-1.2.46.jar;D:\repository\com\esotericsoftware\kryo\4.0.1\kryo-4.0.1.jar;D:\repository\com\esotericsoftware\reflectasm\1.11.3\reflectasm-1.11.3.jar;D:\repository\org\ow2\asm\asm\5.0.4\asm-5.0.4.jar;D:\repository\com\esotericsoftware\minlog\1.3.0\minlog-1.3.0.jar;D:\repository\org\objenesis\objenesis\2.5.1\objenesis-2.5.1.jar;D:\repository\de\javakaffee\kryo-serializers\0.42\kryo-serializers-0.42.jar;D:\repository\de\ruedigermoeller\fst\2.48-jdk-6\fst-2.48-jdk-6.jar;D:\repository\com\fasterxml\jackson\core\jackson-core\2.8.6\jackson-core-2.8.6.jar;D:\repository\com\cedarsoftware\java-util\1.9.0\java-util-1.9.0.jar;D:\repository\com\cedarsoftware\json-io\2.5.1\json-io-2.5.1.jar;D:\repository\org\apache\dubbo\dubbo-container-api\2.7.3\dubbo-container-api-2.7.3.jar;D:\repository\redis\clients\jedis\2.9.0\jedis-2.9.0.jar;D:\repository\org\apache\commons\commons-pool2\2.4.2\commons-pool2-2.4.2.jar;D:\repository\org\apache\dubbo\dubbo\2.7.3\dubbo-2.7.3.jar;D:\repository\org\springframework\spring-context\4.3.16.RELEASE\spring-context-4.3.16.RELEASE.jar;D:\repository\org\springframework\spring-aop\4.3.16.RELEASE\spring-aop-4.3.16.RELEASE.jar;D:\repository\org\springframework\spring-beans\4.3.16.RELEASE\spring-beans-4.3.16.RELEASE.jar;D:\repository\org\springframework\spring-core\4.3.16.RELEASE\spring-core-4.3.16.RELEASE.jar;D:\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\repository\org\springframework\spring-expression\4.3.16.RELEASE\spring-expression-4.3.16.RELEASE.jar;D:\repository\org\javassist\javassist\3.20.0-GA\javassist-3.20.0-GA.jar;D:\repository\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar;D:\repository\org\yaml\snakeyaml\1.20\snakeyaml-1.20.jar;D:\repository\io\netty\netty-all\4.1.25.Final\netty-all-4.1.25.Final.jar
[12/09/19 10:43:57:713 CST] main  INFO zookeeper.ZooKeeper: Client environment:java.library.path=C:\software\jdk-11.0.3\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\software\jdk-11.0.3\bin;C:\software\apache-maven-3.6.1\bin;C:\strawberry\c\bin;C:\strawberry\perl\bin;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\software\MongoDB\bin;D:\software\OpenSSL-Win64\bin;D:\software\curl-7.65.1-win64-mingw\bin;C:\software\node-v12.6.0-win-x64;C:\software\swagger-editor-master;C:\software\Git\cmd;C:\Users\zhang\AppData\Local\Microsoft\WindowsApps;;.
[12/09/19 10:43:57:713 CST] main  INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=C:\Users\zhang\AppData\Local\Temp\
[12/09/19 10:43:57:714 CST] main  INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
[12/09/19 10:43:57:714 CST] main  INFO zookeeper.ZooKeeper: Client environment:os.name=Windows 10
[12/09/19 10:43:57:714 CST] main  INFO zookeeper.ZooKeeper: Client environment:os.arch=amd64
[12/09/19 10:43:57:715 CST] main  INFO zookeeper.ZooKeeper: Client environment:os.version=10.0
[12/09/19 10:43:57:715 CST] main  INFO zookeeper.ZooKeeper: Client environment:user.name=zhang
[12/09/19 10:43:57:715 CST] main  INFO zookeeper.ZooKeeper: Client environment:user.home=C:\Users\zhang
[12/09/19 10:43:57:716 CST] main  INFO zookeeper.ZooKeeper: Client environment:user.dir=F:\IdeaProjects\dubbo
[12/09/19 10:43:57:716 CST] main  INFO zookeeper.ZooKeeper: Client environment:os.memory.free=245MB
[12/09/19 10:43:57:716 CST] main  INFO zookeeper.ZooKeeper: Client environment:os.memory.max=4064MB
[12/09/19 10:43:57:717 CST] main  INFO zookeeper.ZooKeeper: Client environment:os.memory.total=254MB
[12/09/19 10:43:57:718 CST] main  INFO utils.Compatibility: Using emulated InjectSessionExpiration
[12/09/19 10:43:57:774 CST] main  INFO imps.CuratorFrameworkImpl: Starting
[12/09/19 10:43:57:777 CST] main  INFO zookeeper.ZooKeeper: Initiating client connection, connectString=127.0.0.1:2181 sessionTimeout=60000 watcher=org.apache.curator.ConnectionState@7a791b66
[12/09/19 10:43:57:782 CST] main  INFO common.X509Util: Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
[12/09/19 10:43:57:849 CST] main  INFO zookeeper.ClientCnxnSocket: jute.maxbuffer value is 4194304 Bytes
[12/09/19 10:43:57:853 CST] main  INFO zookeeper.ClientCnxn: zookeeper.request.timeout value is 0. feature enabled=
[12/09/19 10:43:57:862 CST] main-SendThread(127.0.0.1:2181)  INFO zookeeper.ClientCnxn: Opening socket connection to server activate.navicat.com/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
[12/09/19 10:43:57:863 CST] main  INFO imps.CuratorFrameworkImpl: Default schema
[12/09/19 10:43:57:863 CST] main  INFO zookeeper.ZookeeperTransporter:  [DUBBO] No valid zookeeper client found from cache, therefore create a new client for url. zookeeper://127.0.0.1:2181/ConfigCenterConfig?config.check=true&config.config-file=dubbo.properties&config.group=dubbo&config.highest-priority=true&config.namespace=dubbo&config.timeout=3000&include.spring.env=false, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:57:864 CST] main-SendThread(127.0.0.1:2181)  INFO zookeeper.ClientCnxn: Socket connection established, initiating session, client: /127.0.0.1:2357, server: activate.navicat.com/127.0.0.1:2181
[12/09/19 10:43:57:892 CST] main-SendThread(127.0.0.1:2181)  INFO zookeeper.ClientCnxn: Session establishment complete on server activate.navicat.com/127.0.0.1:2181, sessionid = 0x100001ad0330004, negotiated timeout = 40000
[12/09/19 10:43:57:897 CST] main-EventThread  INFO state.ConnectionStateManager: State change: CONNECTED
[12/09/19 10:43:57:903 CST] main-EventThread  INFO imps.EnsembleTracker: New config event received: {}
[12/09/19 10:43:57:903 CST] main-EventThread  INFO imps.EnsembleTracker: New config event received: {}
[12/09/19 10:43:57:915 CST] main  WARN config.ConfigurationUtils:  [DUBBO] You specified the config centre, but there's not even one single config item in it., dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:57:915 CST] main  WARN config.ConfigurationUtils:  [DUBBO] You specified the config centre, but there's not even one single config item in it., dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:000 CST] main  INFO config.AbstractConfig:  [DUBBO] Export dubbo service com.zsx.service.UserService to local registry url : injvm://127.0.0.1/com.zsx.service.UserService?anyhost=true&application=provider-server&bean.name=com.zsx.service.UserService&bind.ip=192.168.56.1&bind.port=20880&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=com.zsx.service.UserService&methods=get&pid=13216&qos.port=22222&register=true&release=2.7.3&side=provider&timestamp=1568256237945, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:000 CST] main  INFO config.AbstractConfig:  [DUBBO] Export dubbo service com.zsx.service.UserService to url dubbo://192.168.56.1:20880/com.zsx.service.UserService?anyhost=true&application=provider-server&bean.name=com.zsx.service.UserService&bind.ip=192.168.56.1&bind.port=20880&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=com.zsx.service.UserService&methods=get&pid=13216&qos.port=22222&register=true&release=2.7.3&side=provider&timestamp=1568256237945, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:001 CST] main  INFO config.AbstractConfig:  [DUBBO] There's no valid monitor config found, if you want to open monitor statistics for Dubbo, please make sure your monitor is configured properly., dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:001 CST] main  INFO config.AbstractConfig:  [DUBBO] Register dubbo service com.zsx.service.UserService url dubbo://192.168.56.1:20880/com.zsx.service.UserService?anyhost=true&application=provider-server&bean.name=com.zsx.service.UserService&bind.ip=192.168.56.1&bind.port=20880&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=com.zsx.service.UserService&methods=get&pid=13216&qos.port=22222&register=true&release=2.7.3&side=provider&timestamp=1568256237945 to registry registry://127.0.0.1:2181/org.apache.dubbo.registry.RegistryService?application=provider-server&dubbo=2.0.2&pid=13216&qos.port=22222&registry=zookeeper&release=2.7.3&simplified=true&timestamp=1568256237932, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:179 CST] main  INFO server.Server:  [DUBBO] qos-server bind localhost:22222, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:187 CST] main ERROR common.Version:  [DUBBO] Duplicate class org/apache/dubbo/remoting/exchange/Exchangers.class in 2 jar [file:/D:/repository/org/apache/dubbo/dubbo-remoting-api/2.7.3/dubbo-remoting-api-2.7.3.jar!/org/apache/dubbo/remoting/exchange/Exchangers.class, file:/D:/repository/org/apache/dubbo/dubbo/2.7.3/dubbo-2.7.3.jar!/org/apache/dubbo/remoting/exchange/Exchangers.class], dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:192 CST] main ERROR common.Version:  [DUBBO] Duplicate class org/apache/dubbo/remoting/Transporters.class in 2 jar [file:/D:/repository/org/apache/dubbo/dubbo-remoting-api/2.7.3/dubbo-remoting-api-2.7.3.jar!/org/apache/dubbo/remoting/Transporters.class, file:/D:/repository/org/apache/dubbo/dubbo/2.7.3/dubbo-2.7.3.jar!/org/apache/dubbo/remoting/Transporters.class], dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:193 CST] main ERROR common.Version:  [DUBBO] Duplicate class org/apache/dubbo/remoting/RemotingException.class in 2 jar [file:/D:/repository/org/apache/dubbo/dubbo/2.7.3/dubbo-2.7.3.jar!/org/apache/dubbo/remoting/RemotingException.class, file:/D:/repository/org/apache/dubbo/dubbo-remoting-api/2.7.3/dubbo-remoting-api-2.7.3.jar!/org/apache/dubbo/remoting/RemotingException.class], dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:230 CST] main  INFO transport.AbstractServer:  [DUBBO] Start NettyServer bind /0.0.0.0:20880, export /192.168.56.1:20880, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:233 CST] main  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Load registry cache file C:\Users\zhang\.dubbo\dubbo-registry-provider-server-127.0.0.1:2181.cache, data: {com.zsx.service.UserService=empty://192.168.56.1:20880/com.zsx.service.UserService?anyhost=true&application=provider-server&bean.name=com.zsx.service.UserService&bind.ip=192.168.56.1&bind.port=20880&category=configurators&check=false&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=com.zsx.service.UserService&methods=get&pid=13124&qos.port=22222&register=true&release=2.7.3&side=provider&timestamp=1568256092310}, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:233 CST] main  INFO zookeeper.ZookeeperTransporter:  [DUBBO] find valid zookeeper client from the cache for address: zookeeper://127.0.0.1:2181/org.apache.dubbo.registry.RegistryService?application=provider-server&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=13216&qos.port=22222&release=2.7.3&simplified=true&timestamp=1568256237932, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:235 CST] main  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Register: dubbo://192.168.56.1:20880/com.zsx.service.UserService?application=provider-server&deprecated=false&dubbo=2.0.2&release=2.7.3&timestamp=1568256237945, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:265 CST] main  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Subscribe: provider://192.168.56.1:20880/com.zsx.service.UserService?anyhost=true&application=provider-server&bean.name=com.zsx.service.UserService&bind.ip=192.168.56.1&bind.port=20880&category=configurators&check=false&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=com.zsx.service.UserService&methods=get&pid=13216&qos.port=22222&register=true&release=2.7.3&side=provider&timestamp=1568256237945, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:269 CST] main  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Notify urls for subscribe url provider://192.168.56.1:20880/com.zsx.service.UserService?anyhost=true&application=provider-server&bean.name=com.zsx.service.UserService&bind.ip=192.168.56.1&bind.port=20880&category=configurators&check=false&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=com.zsx.service.UserService&methods=get&pid=13216&qos.port=22222&register=true&release=2.7.3&side=provider&timestamp=1568256237945, urls: [empty://192.168.56.1:20880/com.zsx.service.UserService?anyhost=true&application=provider-server&bean.name=com.zsx.service.UserService&bind.ip=192.168.56.1&bind.port=20880&category=configurators&check=false&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=com.zsx.service.UserService&methods=get&pid=13216&qos.port=22222&register=true&release=2.7.3&side=provider&timestamp=1568256237945], dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:291 CST] main  INFO zookeeper.ZookeeperTransporter:  [DUBBO] find valid zookeeper client from the cache for address: zookeeper://127.0.0.1:2181/org.apache.dubbo.metadata.store.MetadataReport, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:43:58:298 CST] DubboSaveMetadataReport-thread-1  INFO zookeeper.ZookeeperMetadataReport:  [DUBBO] store provider metadata. Identifier : org.apache.dubbo.metadata.identifier.MetadataIdentifier@5b208599; definition: FullServiceDefinition{parameters={side=provider, release=2.7.3, methods=get, deprecated=false, qos.port=22222, dubbo=2.0.2, interface=com.zsx.service.UserService, generic=false, application=provider-server, dynamic=true, register=true, bean.name=com.zsx.service.UserService, anyhost=true}} ServiceDefinition [canonicalName=com.zsx.service.UserService, codeSource=file:/F:/IdeaProjects/dubbo/dubbo-interface/target/classes/, methods=[MethodDefinition [name=get, parameterTypes=[java.lang.String], returnType=java.lang.String]]], dubbo version: 2.7.3, current host: 192.168.56.1


8. 查看请求:

http://localhost:8091/#/service

四、创建服务消费者


1. 创建工程


dubbo-interface,pom.xml文件如下

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.zsx</groupId>
    <artifactId>dubbo-consumer</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>dubbo-consumer</name>
    <description>Dubbo Consumer</description>

    <properties>
        <dubbo-interface.version>0.0.1-SNAPSHOT</dubbo-interface.version>
        <curator.version>4.2.0</curator.version>
        <zookeeper.version>3.5.5</zookeeper.version>
        <javassist.version>3.25.0-GA</javassist.version>
        <dubbo-registry-redis.version>2.7.3</dubbo-registry-redis.version>
    </properties>

    <parent>
        <groupId>com.zsx</groupId>
        <artifactId>dubbo-dependencies</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <relativePath>../dubbo-dependencies/pom.xml</relativePath>
    </parent>

    <dependencies>
        <dependency>
            <groupId>com.zsx</groupId>
            <artifactId>dubbo-interface</artifactId>
            <version>${dubbo-interface.version}</version>
        </dependency>
        <dependency>
            <groupId>com.zsx</groupId>
            <artifactId>dubbo-interface</artifactId>
            <version>${dubbo-interface.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
            <version>${zookeeper.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-framework</artifactId>
            <version>${curator.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-recipes</artifactId>
            <version>${curator.version}</version>
        </dependency>
    </dependencies>

</project>


2. 编写配置文件src/main/resource/com/zsx/dubbo-consumer.xml

<?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://dubbo.apache.org/schema/dubbo"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
       http://dubbo.apache.org/schema/dubbo
       http://dubbo.apache.org/schema/dubbo/dubbo.xsd">

    <!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
    <dubbo:application name="consumer-server"  />

    <!-- 使用zookeeper注册中心暴露发现服务地址 -->
    <dubbo:registry check="false" address="zookeeper://127.0.1.1:2181" />

    <!-- 生成远程服务代理,可以和本地bean一样使用userService -->
    <dubbo:reference id="userService" interface="com.zsx.service.UserService" />
</beans>


3. 编写日志文件src/main/resources/log4j.properties

###set log levels###
log4j.rootLogger=info, stdout
###output to the console###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy HH:mm:ss:SSS z}] %t %5p %c{2}: %m%n


4. 编写src/main/resources/dubbo.properties配置文件

dubbo.application.qos.port=33333


5. 创建主程序启动类

package com.zsx;

import com.zsx.service.UserService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ConsumerApplication {

    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("com/zsx/dubbo-consumer.xml");
        context.start();
        UserService userService = (UserService)context.getBean("userService"); // 获取远程服务代理
        String msg = userService.get("hello world"); // 执行远程方法
        System.out.println( msg ); // 显示调用结果
    }
}


6. 启动服务提供者后,再启动消费者

C:\software\jdk-11.0.3\bin\java.exe "-javaagent:C:\software\JetBrains\IntelliJ IDEA 2019.1.3\lib\idea_rt.jar=2429:C:\software\JetBrains\IntelliJ IDEA 2019.1.3\bin" -Dfile.encoding=UTF-8 -classpath F:\IdeaProjects\dubbo\dubbo-consumer\target\classes;F:\IdeaProjects\dubbo\dubbo-interface\target\classes;D:\repository\org\apache\zookeeper\zookeeper\3.5.5\zookeeper-3.5.5.jar;D:\repository\org\apache\zookeeper\zookeeper-jute\3.5.5\zookeeper-jute-3.5.5.jar;D:\repository\org\apache\yetus\audience-annotations\0.5.0\audience-annotations-0.5.0.jar;D:\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\repository\org\slf4j\slf4j-log4j12\1.7.25\slf4j-log4j12-1.7.25.jar;D:\repository\log4j\log4j\1.2.16\log4j-1.2.16.jar;D:\repository\org\apache\curator\curator-framework\4.2.0\curator-framework-4.2.0.jar;D:\repository\org\apache\curator\curator-client\4.2.0\curator-client-4.2.0.jar;D:\repository\com\google\guava\guava\27.0.1-jre\guava-27.0.1-jre.jar;D:\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;D:\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;D:\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;D:\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar;D:\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar;D:\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;D:\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar;D:\repository\org\apache\curator\curator-recipes\4.2.0\curator-recipes-4.2.0.jar;D:\repository\org\apache\dubbo\dubbo\2.7.3\dubbo-2.7.3.jar;D:\repository\org\springframework\spring-context\4.3.16.RELEASE\spring-context-4.3.16.RELEASE.jar;D:\repository\org\springframework\spring-aop\4.3.16.RELEASE\spring-aop-4.3.16.RELEASE.jar;D:\repository\org\springframework\spring-beans\4.3.16.RELEASE\spring-beans-4.3.16.RELEASE.jar;D:\repository\org\springframework\spring-core\4.3.16.RELEASE\spring-core-4.3.16.RELEASE.jar;D:\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\repository\org\springframework\spring-expression\4.3.16.RELEASE\spring-expression-4.3.16.RELEASE.jar;D:\repository\org\javassist\javassist\3.20.0-GA\javassist-3.20.0-GA.jar;D:\repository\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar;D:\repository\org\yaml\snakeyaml\1.20\snakeyaml-1.20.jar;D:\repository\io\netty\netty-all\4.1.25.Final\netty-all-4.1.25.Final.jar com.zsx.ConsumerApplication
[12/09/19 10:45:46:510 CST] main  INFO support.ClassPathXmlApplicationContext: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1efee8e7: startup date [Thu Sep 12 10:45:46 CST 2019]; root of context hierarchy
[12/09/19 10:45:46:555 CST] main  INFO xml.XmlBeanDefinitionReader: Loading XML bean definitions from class path resource [com/zsx/dubbo-consumer.xml]
[12/09/19 10:45:46:714 CST] main  INFO logger.LoggerFactory: using logger: org.apache.dubbo.common.logger.log4j.Log4jLoggerAdapter
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by javassist.ClassPool (file:/D:/repository/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of javassist.ClassPool
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[12/09/19 10:45:47:043 CST] main  WARN config.AbstractConfig:  [DUBBO] There's no valid metadata config found, if you are using the simplified mode of registry url, please make sure you have a metadata address configured properly., dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:56:227 CST] main  INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.5.5-390fe37ea45dee01bf87dc1c042b5e3dcce88653, built on 05/03/2019 12:07 GMT
[12/09/19 10:45:56:228 CST] main  INFO zookeeper.ZooKeeper: Client environment:host.name=zsx
[12/09/19 10:45:56:228 CST] main  INFO zookeeper.ZooKeeper: Client environment:java.version=11.0.3
[12/09/19 10:45:56:228 CST] main  INFO zookeeper.ZooKeeper: Client environment:java.vendor=Oracle Corporation
[12/09/19 10:45:56:228 CST] main  INFO zookeeper.ZooKeeper: Client environment:java.home=C:\software\jdk-11.0.3
[12/09/19 10:45:56:228 CST] main  INFO zookeeper.ZooKeeper: Client environment:java.class.path=F:\IdeaProjects\dubbo\dubbo-consumer\target\classes;F:\IdeaProjects\dubbo\dubbo-interface\target\classes;D:\repository\org\apache\zookeeper\zookeeper\3.5.5\zookeeper-3.5.5.jar;D:\repository\org\apache\zookeeper\zookeeper-jute\3.5.5\zookeeper-jute-3.5.5.jar;D:\repository\org\apache\yetus\audience-annotations\0.5.0\audience-annotations-0.5.0.jar;D:\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\repository\org\slf4j\slf4j-log4j12\1.7.25\slf4j-log4j12-1.7.25.jar;D:\repository\log4j\log4j\1.2.16\log4j-1.2.16.jar;D:\repository\org\apache\curator\curator-framework\4.2.0\curator-framework-4.2.0.jar;D:\repository\org\apache\curator\curator-client\4.2.0\curator-client-4.2.0.jar;D:\repository\com\google\guava\guava\27.0.1-jre\guava-27.0.1-jre.jar;D:\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;D:\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;D:\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;D:\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar;D:\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar;D:\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;D:\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar;D:\repository\org\apache\curator\curator-recipes\4.2.0\curator-recipes-4.2.0.jar;D:\repository\org\apache\dubbo\dubbo\2.7.3\dubbo-2.7.3.jar;D:\repository\org\springframework\spring-context\4.3.16.RELEASE\spring-context-4.3.16.RELEASE.jar;D:\repository\org\springframework\spring-aop\4.3.16.RELEASE\spring-aop-4.3.16.RELEASE.jar;D:\repository\org\springframework\spring-beans\4.3.16.RELEASE\spring-beans-4.3.16.RELEASE.jar;D:\repository\org\springframework\spring-core\4.3.16.RELEASE\spring-core-4.3.16.RELEASE.jar;D:\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\repository\org\springframework\spring-expression\4.3.16.RELEASE\spring-expression-4.3.16.RELEASE.jar;D:\repository\org\javassist\javassist\3.20.0-GA\javassist-3.20.0-GA.jar;D:\repository\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar;D:\repository\org\yaml\snakeyaml\1.20\snakeyaml-1.20.jar;D:\repository\io\netty\netty-all\4.1.25.Final\netty-all-4.1.25.Final.jar
[12/09/19 10:45:56:229 CST] main  INFO zookeeper.ZooKeeper: Client environment:java.library.path=C:\software\jdk-11.0.3\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\software\jdk-11.0.3\bin;C:\software\apache-maven-3.6.1\bin;C:\strawberry\c\bin;C:\strawberry\perl\bin;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\software\MongoDB\bin;D:\software\OpenSSL-Win64\bin;D:\software\curl-7.65.1-win64-mingw\bin;C:\software\node-v12.6.0-win-x64;C:\software\swagger-editor-master;C:\software\Git\cmd;C:\Users\zhang\AppData\Local\Microsoft\WindowsApps;;.
[12/09/19 10:45:56:229 CST] main  INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=C:\Users\zhang\AppData\Local\Temp\
[12/09/19 10:45:56:229 CST] main  INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
[12/09/19 10:45:56:229 CST] main  INFO zookeeper.ZooKeeper: Client environment:os.name=Windows 10
[12/09/19 10:45:56:230 CST] main  INFO zookeeper.ZooKeeper: Client environment:os.arch=amd64
[12/09/19 10:45:56:230 CST] main  INFO zookeeper.ZooKeeper: Client environment:os.version=10.0
[12/09/19 10:45:56:230 CST] main  INFO zookeeper.ZooKeeper: Client environment:user.name=zhang
[12/09/19 10:45:56:230 CST] main  INFO zookeeper.ZooKeeper: Client environment:user.home=C:\Users\zhang
[12/09/19 10:45:56:230 CST] main  INFO zookeeper.ZooKeeper: Client environment:user.dir=F:\IdeaProjects\dubbo
[12/09/19 10:45:56:231 CST] main  INFO zookeeper.ZooKeeper: Client environment:os.memory.free=244MB
[12/09/19 10:45:56:231 CST] main  INFO zookeeper.ZooKeeper: Client environment:os.memory.max=4064MB
[12/09/19 10:45:56:231 CST] main  INFO zookeeper.ZooKeeper: Client environment:os.memory.total=254MB
[12/09/19 10:45:56:233 CST] main  INFO utils.Compatibility: Using emulated InjectSessionExpiration
[12/09/19 10:45:56:285 CST] main  INFO imps.CuratorFrameworkImpl: Starting
[12/09/19 10:45:56:288 CST] main  INFO zookeeper.ZooKeeper: Initiating client connection, connectString=127.0.1.1:2181 sessionTimeout=60000 watcher=org.apache.curator.ConnectionState@4fc5e095
[12/09/19 10:45:56:293 CST] main  INFO common.X509Util: Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
[12/09/19 10:45:56:385 CST] main  INFO zookeeper.ClientCnxnSocket: jute.maxbuffer value is 4194304 Bytes
[12/09/19 10:45:56:389 CST] main  INFO zookeeper.ClientCnxn: zookeeper.request.timeout value is 0. feature enabled=
[12/09/19 10:45:56:396 CST] main  INFO imps.CuratorFrameworkImpl: Default schema
[12/09/19 10:45:56:396 CST] main  INFO zookeeper.ZookeeperTransporter:  [DUBBO] No valid zookeeper client found from cache, therefore create a new client for url. zookeeper://127.0.1.1:2181/ConfigCenterConfig?config.check=true&config.config-file=dubbo.properties&config.group=dubbo&config.highest-priority=false&config.namespace=dubbo&config.timeout=3000, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:045 CST] main-SendThread(127.0.1.1:2181)  INFO zookeeper.ClientCnxn: Opening socket connection to server 127.0.1.1/127.0.1.1:2181. Will not attempt to authenticate using SASL (unknown error)
[12/09/19 10:45:58:052 CST] main-SendThread(127.0.1.1:2181)  INFO zookeeper.ClientCnxn: Socket connection established, initiating session, client: /127.0.0.1:2439, server: 127.0.1.1/127.0.1.1:2181
[12/09/19 10:45:58:092 CST] main-SendThread(127.0.1.1:2181)  INFO zookeeper.ClientCnxn: Session establishment complete on server 127.0.1.1/127.0.1.1:2181, sessionid = 0x100001ad0330005, negotiated timeout = 40000
[12/09/19 10:45:58:109 CST] main-EventThread  INFO state.ConnectionStateManager: State change: CONNECTED
[12/09/19 10:45:58:138 CST] main-EventThread  INFO imps.EnsembleTracker: New config event received: {}
[12/09/19 10:45:58:140 CST] main-EventThread  INFO imps.EnsembleTracker: New config event received: {}
[12/09/19 10:45:58:175 CST] main  WARN config.ConfigurationUtils:  [DUBBO] You specified the config centre, but there's not even one single config item in it., dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:175 CST] main  WARN config.ConfigurationUtils:  [DUBBO] You specified the config centre, but there's not even one single config item in it., dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:196 CST] main  INFO config.AbstractConfig:  [DUBBO] There's no valid monitor config found, if you want to open monitor statistics for Dubbo, please make sure your monitor is configured properly., dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:364 CST] main  INFO server.Server:  [DUBBO] qos-server bind localhost:33333, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:367 CST] main  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Load registry cache file C:\Users\zhang\.dubbo\dubbo-registry-consumer-server-127.0.1.1:2181.cache, data: {com.zsx.service.UserService=empty://192.168.56.1/com.zsx.service.UserService?application=consumer-server&category=routers&dubbo=2.0.2&interface=com.zsx.service.UserService&lazy=false&methods=get&pid=7192&qos.port=33333&release=2.7.3&side=consumer&sticky=false&timestamp=1568192174763 empty://192.168.56.1/com.zsx.service.UserService?application=consumer-server&category=configurators&dubbo=2.0.2&interface=com.zsx.service.UserService&lazy=false&methods=get&pid=7192&qos.port=33333&release=2.7.3&side=consumer&sticky=false&timestamp=1568192174763 dubbo://192.168.56.1:20880/com.zsx.service.UserService?application=user-service&deprecated=false&dubbo=2.0.2&release=2.7.3&timestamp=1568190777373}, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:369 CST] main  INFO zookeeper.ZookeeperTransporter:  [DUBBO] find valid zookeeper client from the cache for address: zookeeper://127.0.1.1:2181/org.apache.dubbo.registry.RegistryService?application=consumer-server&check=false&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=6300&qos.port=33333&release=2.7.3&timestamp=1568256358193, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:379 CST] main  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Register: consumer://192.168.56.1/com.zsx.service.UserService?application=consumer-server&category=consumers&check=false&dubbo=2.0.2&interface=com.zsx.service.UserService&lazy=false&methods=get&pid=6300&qos.port=33333&release=2.7.3&side=consumer&sticky=false&timestamp=1568256347043, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:416 CST] main  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Subscribe: consumer://192.168.56.1/com.zsx.service.UserService?application=consumer-server&category=providers,configurators,routers&dubbo=2.0.2&interface=com.zsx.service.UserService&lazy=false&methods=get&pid=6300&qos.port=33333&release=2.7.3&side=consumer&sticky=false&timestamp=1568256347043, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:423 CST] main  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Notify urls for subscribe url consumer://192.168.56.1/com.zsx.service.UserService?application=consumer-server&category=providers,configurators,routers&dubbo=2.0.2&interface=com.zsx.service.UserService&lazy=false&methods=get&pid=6300&qos.port=33333&release=2.7.3&side=consumer&sticky=false&timestamp=1568256347043, urls: [dubbo://192.168.56.1:20880/com.zsx.service.UserService?application=provider-server&deprecated=false&dubbo=2.0.2&release=2.7.3&timestamp=1568256237945, empty://192.168.56.1/com.zsx.service.UserService?application=consumer-server&category=configurators&dubbo=2.0.2&interface=com.zsx.service.UserService&lazy=false&methods=get&pid=6300&qos.port=33333&release=2.7.3&side=consumer&sticky=false&timestamp=1568256347043, empty://192.168.56.1/com.zsx.service.UserService?application=consumer-server&category=routers&dubbo=2.0.2&interface=com.zsx.service.UserService&lazy=false&methods=get&pid=6300&qos.port=33333&release=2.7.3&side=consumer&sticky=false&timestamp=1568256347043], dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:544 CST] main  INFO transport.AbstractClient:  [DUBBO] Succeed connect to server /192.168.56.1:20880 from NettyClient 192.168.56.1 using dubbo version 2.7.3, channel is NettyChannel [channel=[id: 0x1525dd06, L:/192.168.56.1:2492 - R:/192.168.56.1:20880]], dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:545 CST] main  INFO transport.AbstractClient:  [DUBBO] Start NettyClient zsx/192.168.56.1 connect to the server /192.168.56.1:20880, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:586 CST] main  INFO config.AbstractConfig:  [DUBBO] Refer dubbo service com.zsx.service.UserService from url zookeeper://127.0.1.1:2181/org.apache.dubbo.registry.RegistryService?application=consumer-server&check=false&deprecated=false&dubbo=2.0.2&interface=com.zsx.service.UserService&lazy=false&methods=get&pid=6300&qos.port=33333&register.ip=192.168.56.1&release=2.7.3&remote.application=provider-server&side=consumer&sticky=false&timestamp=1568256347043, dubbo version: 2.7.3, current host: 192.168.56.1
The message content is : hello world, Service address is : 192.168.56.1:20880
[12/09/19 10:45:58:764 CST] Thread-0  INFO support.ClassPathXmlApplicationContext: Closing org.springframework.context.support.ClassPathXmlApplicationContext@1efee8e7: startup date [Thu Sep 12 10:45:46 CST 2019]; root of context hierarchy
[12/09/19 10:45:58:765 CST] Thread-0  INFO support.AbstractRegistryFactory:  [DUBBO] Close all registries [zookeeper://127.0.1.1:2181/org.apache.dubbo.registry.RegistryService?application=consumer-server&check=false&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=6300&qos.port=33333&release=2.7.3&timestamp=1568256358193], dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:765 CST] Thread-0  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Destroy registry:zookeeper://127.0.1.1:2181/org.apache.dubbo.registry.RegistryService?application=consumer-server&check=false&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=6300&qos.port=33333&release=2.7.3&timestamp=1568256358193, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:766 CST] Thread-0  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Unregister: consumer://192.168.56.1/com.zsx.service.UserService?application=consumer-server&category=consumers&check=false&dubbo=2.0.2&interface=com.zsx.service.UserService&lazy=false&methods=get&pid=6300&qos.port=33333&release=2.7.3&side=consumer&sticky=false&timestamp=1568256347043, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:794 CST] Thread-0  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Destroy unregister url consumer://192.168.56.1/com.zsx.service.UserService?application=consumer-server&category=consumers&check=false&dubbo=2.0.2&interface=com.zsx.service.UserService&lazy=false&methods=get&pid=6300&qos.port=33333&release=2.7.3&side=consumer&sticky=false&timestamp=1568256347043, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:795 CST] Thread-0  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Unsubscribe: consumer://192.168.56.1/com.zsx.service.UserService?application=consumer-server&category=providers,configurators,routers&dubbo=2.0.2&interface=com.zsx.service.UserService&lazy=false&methods=get&pid=6300&qos.port=33333&release=2.7.3&side=consumer&sticky=false&timestamp=1568256347043, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:795 CST] Thread-0  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Destroy unsubscribe url consumer://192.168.56.1/com.zsx.service.UserService?application=consumer-server&category=providers,configurators,routers&dubbo=2.0.2&interface=com.zsx.service.UserService&lazy=false&methods=get&pid=6300&qos.port=33333&release=2.7.3&side=consumer&sticky=false&timestamp=1568256347043, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:795 CST] Curator-Framework-0  INFO imps.CuratorFrameworkImpl: backgroundOperationsLoop exiting
[12/09/19 10:45:58:958 CST] Thread-0  INFO zookeeper.ZooKeeper: Session: 0x100001ad0330005 closed
[12/09/19 10:45:58:958 CST] main-EventThread  INFO zookeeper.ClientCnxn: EventThread shut down for session: 0x100001ad0330005
[12/09/19 10:45:58:959 CST] Thread-0  INFO dubbo.DubboProtocol:  [DUBBO] Close dubbo connect: /192.168.56.1:2492-->/192.168.56.1:20880, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:961 CST] Thread-0  INFO netty4.NettyChannel:  [DUBBO] Close netty channel [id: 0x1525dd06, L:/192.168.56.1:2492 - R:/192.168.56.1:20880], dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:964 CST] Thread-0  INFO dubbo.DubboProtocol:  [DUBBO] Destroy reference: dubbo://192.168.56.1:20880/com.zsx.service.UserService?application=consumer-server&check=false&deprecated=false&dubbo=2.0.2&interface=com.zsx.service.UserService&lazy=false&pid=6300&qos.port=33333&register.ip=192.168.56.1&release=2.7.3&remote.application=provider-server&side=consumer&sticky=false&timestamp=1568256237945, dubbo version: 2.7.3, current host: 192.168.56.1
[12/09/19 10:45:58:964 CST] Thread-0  INFO server.Server:  [DUBBO] qos-server stopped., dubbo version: 2.7.3, current host: 192.168.56.1

Process finished with exit code 0



到此简单配置成功



版权声明:本文为zsx18273117003原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。