About the solution to the automatic stop of the dubbo service after it is started

 

 

I am going to go through the dubbo-related knowledge system at home for two days on weekends. By the way, I will write a demo for future needs. Whenever I write a demo, I will first look for someone else to summarize it on the Internet. If there is, I will take it directly and modify it It's ok. Via " A Simple Dubbo Service "

This article found the corresponding demo example on github, just cloned it down and read it against the article, no problem, and tried to start the dubbo service.

 

Start the provider:

C:\Program Files\Java\jdk1.8.0_101\bin\java"

......

[27/08/17 10:48:39:039 CST] main  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Notify urls for subscribe url provider://192.168.1.101:20880/api.PermissionService?anyhost=true&application=demotest-provider&category=configurators&check=false&dubbo=2.4.10&interface=api.PermissionService&methods=getPermissions&organization=dubbox&owner=programmer&pid=7436&side=provider×tamp=1503802117211, urls: [empty://192.168.1.101:20880/api.PermissionService?anyhost=true&application=demotest-provider&category=configurators&check=false&dubbo=2.4.10&interface=api.PermissionService&methods=getPermissions&organization=dubbox&owner=programmer&pid=7436&side=provider×tamp=1503802117211], dubbo version: 2.4.10, current host: 127.0.0.1

[27/08/17 10:48:39:039 CST] main  INFO container.Main:  [DUBBO] Dubbo SpringContainer started!, dubbo version: 2.4.10, current host: 127.0.0.1

[2017-08-27 10:48:39] Dubbo service server started!

  Start normally, no problem!

 

Start the consumer:
"C:\Program Files\Java\jdk1.8.0_101\bin\java" 
......
[27/08/17 10:50:58:058 CST] main  INFO config.AbstractConfig:  [DUBBO] Refer dubbo service api.PermissionService from url zookeeper://localhost:2181/com.alibaba.dubbo.registry.RegistryService?anyhost=true&application=demotest-consumer&check=false&connected=true&dubbo=2.4.10&inside.invoker.count=1&inside.invokers=dubbo%3A%2F%2F192.168.1.101%3A20880%2Fapi.PermissionService%3Fanyhost%3Dtrue%26application%3Ddemotest-provider%26dubbo%3D2.4.10%26interface%3Dapi.PermissionService%26methods%3DgetPermissions%26organization%3Ddubbox%26owner%3Dprogrammer%26pid%3D7436%26side%3Dprovider%26timestamp%3D1503802117211&interface=api.PermissionService&methods=getPermissions&organization=dubbox&owner=programmer&pid=8096&side=consumer×tamp=1503802256832, dubbo version: 2.4.10, current host: 192.168.1.101
[Permission_0, Permission_1, Permission_2]
[27/08/17 10:50:58:058 CST] DubboShutdownHook  INFO config.AbstractConfig:  [DUBBO] Run shutdown hook now., dubbo version: 2.4.10, current host: 192.168.1.101
[27/08/17 10:50:58:058 CST] DubboShutdownHook  INFO support.AbstractRegistryFactory:  [DUBBO] Close all registries [zookeeper://localhost:2181/com.alibaba.dubbo.registry.RegistryService?application=demotest-consumer&dubbo=2.4.10&interface=com.alibaba.dubbo.registry.RegistryService&organization=dubbox&owner=programmer&pid=8096×tamp=1503802256900], dubbo version: 2.4.10, current host: 192.168.1.101
[27/08/17 10:50:58:058 CST] DubboShutdownHook  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Destroy registry:zookeeper://localhost:2181/com.alibaba.dubbo.registry.RegistryService?application=demotest-consumer&dubbo=2.4.10&interface=com.alibaba.dubbo.registry.RegistryService&organization=dubbox&owner=programmer&pid=8096×tamp=1503802256900, dubbo version: 2.4.10, current host: 192.168.1.101
......
  Here comes the problem, automatically shut down the consumer service after consuming the provider service! After some tossing and replacing the dubbo version number (2.8.4), it runs normally!  
......
[27/08/17 10:37:10:010 CST] main  INFO config.AbstractConfig:  [DUBBO] Refer dubbo service api.PermissionService from url zookeeper://localhost:2181/com.alibaba.dubbo.registry.RegistryService?anyhost=true&application=demotest-consumer&check=false&dubbo=2.8.4&generic=false&interface=api.PermissionService&methods=getPermissions&organization=dubbox&owner=programmer&pid=11580&side=consumer×tamp=1503801428993, dubbo version: 2.8.4, current host: 192.168.1.101
[Permission_0, Permission_1, Permission_2]
  1. Why replace the dubbo version number specified by the original sample project pom.xml? In fact, not only the dubbo version number is replaced, the dubbo framework in pom.xml in the sample project depends on the spring in its own framework, and the spring dependencies inside are chaotic. When replacing, the dubbo version number is replaced from 2.8.4 to 2.4.10, it is precisely due to the low version of the framework bug that caused the problem, after changing back to the 2.8.4 version, it runs perfectly! Complete pom.xml:
<properties>
    <org.springframework.version>4.0.3.RELEASE</org.springframework.version>
    <alibaba.dubbo.version>2.8.4</alibaba.dubbo.version>
    <zkclient.version>0.1</zkclient.version>
    <log4j.version>1.2.17</log4j.version>
</properties>
<dependencies>
    <dependency>
        <groupId>dubbotest</groupId>
        <artifactId>api</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <!-- spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <!-- alibaba dubbo -->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>dubbo</artifactId>
        <version>${alibaba.dubbo.version}</version>
        <exclusions>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.github.sgroschupf</groupId>
        <artifactId>zkclient</artifactId>
        <version>${zkclient.version}</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>${log4j.version}</version>
    </dependency>
</dependencies>
     

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326299422&siteId=291194637