本文通过springboot整合dubbo,并且可以通过在浏览器中访问一个链接获取调用结果。主要包括2个工程:dubbo-provider-demo和dubbo-consumer-demo。开发ide是eclipse。dubbo官方提供的spring boot starter工程地址是incubator-dubbo-spring-boot-project。
dubbo-provider-demo工程
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.ms</groupId>
<artifactId>dubbo-provider-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>dubbo-provider-demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>0.2.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
然后是编写HelloService:
package com.ms.dubbo.service;
/**
* @author iengchen
* @since 2018-11-24
*/
public interface HelloService {
public String sayHello(String name);
}
可以看到该接口只包含一个方法。注意:dubbo-consumer-demo工程也要包含这个接口,并且路径最好一样,也就是最好也放在dubbo-consumer-demo工程的com.ms.dubbo.service这个包下面。
然后编写接口的实现:
package com.ms.dubbo.service;
import com.alibaba.dubbo.config.annotation.Service;
/**
* @author iengchen
* @since 2018-11-24
*/
@Service
public class HelloServiceImpl implements HelloService{
@Override
public String sayHello(String name) {
return "hello,"+name;
}
}
注意:实现类必须要有dubbo提供的注解@Service
。
application.properties内容如下:
# Spring boot application
spring.application.name = dubbo-provider-demo
server.port = 9090
# Base packages to scan Dubbo Components (e.g., @Service, @Reference)
dubbo.scan.basePackages = com.ms.dubbo.service
# Dubbo Config properties
## ApplicationConfig Bean
dubbo.application.id = dubbo-provider-demo
dubbo.application.name = dubbo-provider-demo
## ProtocolConfig Bean
dubbo.protocol.id = dubbo
dubbo.protocol.name = dubbo
dubbo.protocol.port = 12345
## RegistryConfig Bean
dubbo.registry.id = my-registry
dubbo.registry.address = zookeeper://127.0.0.1:2181
注意:刚才编写的接口和实现类都放在com.ms.dubbo.service
这个package下面,因此这里需要配置dubbo.scan.basePackages = com.ms.dubbo.service
dubbo-consumer-demo工程
pom.xml内容和dubbo-provider-demo工程的pom.xml一样。
application.properties内容如下:
# Spring boot application
spring.application.name = dubbo-consumer-demo
server.port = 8080
# Dubbo Config properties
## ApplicationConfig Bean
dubbo.application.id = dubbo-consumer-demo
dubbo.application.name = dubbo-consumer-demo
## ProtocolConfig Bean
dubbo.protocol.id = dubbo
dubbo.protocol.name = dubbo
dubbo.protocol.port = 12345
dubbo.registry.address = zookeeper://127.0.0.1:2181
然后是接口HelloService,将dubbo-provider-demo中的HelloService拷贝过来即可。
最后是编写一个controller:
package com.ms.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.dubbo.config.annotation.Reference;
import com.ms.dubbo.service.HelloService;
/**
* @author iengchen
* @since 2018-11-24
*/
@RestController
public class HelloController {
@Reference
HelloService service;
@RequestMapping("/say")
public String sayHello(@RequestParam String name) {
System.out.println("用户名是:"+name);
return service.sayHello(name);
}
}
这里使用dubbo提供的注解@Reference
引用远程服务。
编写完dubbo-provider-demo和dubbo-consumer-demo这2个工程以后,可以启动工程了,在其中这2个工程之前要先启动zookeeper.
启动zookeeper
mac上zookeeper的安装参考mac使用homebrew安装zookeeper,windows上zookeeper的安装参考windows安装和运行zookeeper集群.
mac上可以使用命令$ zkServer start
启动单机模式的zookeeper。
启动provider
使用run as->spring boot app启动:
2018-11-24 16:02:59.247 INFO 85046 --- [ main] c.a.dubbo.common.logger.LoggerFactory : using logger: com.alibaba.dubbo.common.logger.slf4j.Slf4jLoggerAdapter
2018-11-24 16:02:59.251 INFO 85046 --- [ main] a.b.d.c.e.WelcomeLogoApplicationListener :
:: Dubbo Spring Boot (v0.2.0) : https://github.com/apache/incubator-dubbo-spring-boot-project
:: Dubbo (v2.6.2) : https://github.com/apache/incubator-dubbo
:: Google group : dev@dubbo.incubator.apache.org
2018-11-24 16:02:59.254 INFO 85046 --- [ main] e.OverrideDubboConfigApplicationListener : Dubbo Config was overridden by externalized configuration {dubbo.application.id=dubbo-provider-demo, dubbo.application.name=dubbo-provider-demo, dubbo.protocol.id=dubbo, dubbo.protocol.name=dubbo, dubbo.protocol.port=12345, dubbo.registry.address=zookeeper://127.0.0.1:2181, dubbo.registry.id=my-registry, dubbo.scan.basePackages=com.ms.dubbo.service }
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.6.RELEASE)
2018-11-24 16:02:59.343 INFO 85046 --- [ main] com.ms.DubboProviderDemoApplication : Starting DubboProviderDemoApplication on MacBookPro with PID 85046 (/Users/chenxin/Eclipse-Workspace/default/dubbo-provider-demo/target/classes started by chenxin in /Users/chenxin/Eclipse-Workspace/default/dubbo-provider-demo)
2018-11-24 16:02:59.344 INFO 85046 --- [ main] com.ms.DubboProviderDemoApplication : No active profile set, falling back to default profiles: default
2018-11-24 16:02:59.387 INFO 85046 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@5e316c74: startup date [Sat Nov 24 16:02:59 CST 2018]; root of context hierarchy
2018-11-24 16:02:59.734 INFO 85046 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The dubbo config bean definition [name : dubbo-provider-demo, class : com.alibaba.dubbo.config.ApplicationConfig] has been registered.
2018-11-24 16:02:59.735 INFO 85046 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The BeanPostProcessor bean definition [com.alibaba.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor] for dubbo config bean [name : dubbo-provider-demo] has been registered.
2018-11-24 16:02:59.735 INFO 85046 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The dubbo config bean definition [name : my-registry, class : com.alibaba.dubbo.config.RegistryConfig] has been registered.
2018-11-24 16:02:59.735 INFO 85046 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The BeanPostProcessor bean definition [com.alibaba.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor] for dubbo config bean [name : my-registry] has been registered.
2018-11-24 16:02:59.735 INFO 85046 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The dubbo config bean definition [name : dubbo, class : com.alibaba.dubbo.config.ProtocolConfig] has been registered.
2018-11-24 16:02:59.736 INFO 85046 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The BeanPostProcessor bean definition [com.alibaba.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor] for dubbo config bean [name : dubbo] has been registered.
2018-11-24 16:02:59.782 INFO 85046 --- [ main] b.f.a.ServiceAnnotationBeanPostProcessor : [DUBBO] BeanNameGenerator bean can't be found in BeanFactory with name [org.springframework.context.annotation.internalConfigurationBeanNameGenerator], dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:02:59.782 INFO 85046 --- [ main] b.f.a.ServiceAnnotationBeanPostProcessor : [DUBBO] BeanNameGenerator will be a instance of org.springframework.context.annotation.AnnotationBeanNameGenerator , it maybe a potential problem on bean name generation., dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:02:59.791 WARN 85046 --- [ main] b.f.a.ServiceAnnotationBeanPostProcessor : [DUBBO] The BeanDefinition[Root bean: class [com.alibaba.dubbo.config.spring.ServiceBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] of ServiceBean has been registered with name : ServiceBean:helloServiceImpl:com.ms.dubbo.service.HelloService, dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:02:59.792 INFO 85046 --- [ main] b.f.a.ServiceAnnotationBeanPostProcessor : [DUBBO] 1 annotated Dubbo's @Service Components { [Bean definition with name 'helloServiceImpl': Generic bean: class [com.ms.dubbo.service.HelloServiceImpl]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [/Users/chenxin/Eclipse-Workspace/default/dubbo-provider-demo/target/classes/com/ms/dubbo/service/HelloServiceImpl.class]] } were scanned under package[com.ms.dubbo.service], dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:02:59.792 WARN 85046 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean definition 'com.alibaba.boot.dubbo.autoconfigure.DubboAutoConfiguration' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2018-11-24 16:02:59.968 INFO 85046 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'relaxedDubboConfigBinder' of type [com.alibaba.boot.dubbo.autoconfigure.RelaxedDubboConfigBinder] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-11-24 16:02:59.970 INFO 85046 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'relaxedDubboConfigBinder' of type [com.alibaba.boot.dubbo.autoconfigure.RelaxedDubboConfigBinder] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-11-24 16:02:59.971 INFO 85046 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'relaxedDubboConfigBinder' of type [com.alibaba.boot.dubbo.autoconfigure.RelaxedDubboConfigBinder] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-11-24 16:03:00.299 INFO 85046 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9090 (http)
2018-11-24 16:03:00.323 INFO 85046 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-11-24 16:03:00.323 INFO 85046 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.34
2018-11-24 16:03:00.331 INFO 85046 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/chenxin/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2018-11-24 16:03:00.403 INFO 85046 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-11-24 16:03:00.418 INFO 85046 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1034 ms
2018-11-24 16:03:00.464 INFO 85046 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-11-24 16:03:00.466 INFO 85046 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-11-24 16:03:00.467 INFO 85046 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-11-24 16:03:00.467 INFO 85046 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-11-24 16:03:00.467 INFO 85046 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-11-24 16:03:00.554 INFO 85046 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-24 16:03:00.664 INFO 85046 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@5e316c74: startup date [Sat Nov 24 16:02:59 CST 2018]; root of context hierarchy
2018-11-24 16:03:00.716 INFO 85046 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-11-24 16:03:00.717 INFO 85046 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-11-24 16:03:00.737 INFO 85046 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-24 16:03:00.737 INFO 85046 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-24 16:03:00.784 INFO 85046 --- [ main] .f.a.DubboConfigBindingBeanPostProcessor : The properties of bean [name : dubbo-provider-demo] have been binding by prefix of configuration properties : dubbo.application
2018-11-24 16:03:00.792 INFO 85046 --- [ main] .f.a.DubboConfigBindingBeanPostProcessor : The properties of bean [name : my-registry] have been binding by prefix of configuration properties : dubbo.registry
2018-11-24 16:03:00.799 INFO 85046 --- [ main] .f.a.DubboConfigBindingBeanPostProcessor : The properties of bean [name : dubbo] have been binding by prefix of configuration properties : dubbo.protocol
2018-11-24 16:03:01.027 INFO 85046 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-11-24 16:03:01.038 INFO 85046 --- [ main] com.alibaba.dubbo.config.AbstractConfig : [DUBBO] The service ready on spring started. service: com.ms.dubbo.service.HelloService, dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:03:01.098 INFO 85046 --- [ main] com.alibaba.dubbo.config.AbstractConfig : [DUBBO] Export dubbo service com.ms.dubbo.service.HelloService to local registry, dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:03:01.098 INFO 85046 --- [ main] com.alibaba.dubbo.config.AbstractConfig : [DUBBO] Export dubbo service com.ms.dubbo.service.HelloService to url dubbo://192.168.0.103:12345/com.ms.dubbo.service.HelloService?anyhost=true&application=dubbo-provider-demo&bind.ip=192.168.0.103&bind.port=12345&dubbo=2.6.2&generic=false&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=85046&side=provider×tamp=1543046581046, dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:03:01.098 INFO 85046 --- [ main] com.alibaba.dubbo.config.AbstractConfig : [DUBBO] Register dubbo service com.ms.dubbo.service.HelloService url dubbo://192.168.0.103:12345/com.ms.dubbo.service.HelloService?anyhost=true&application=dubbo-provider-demo&bind.ip=192.168.0.103&bind.port=12345&dubbo=2.6.2&generic=false&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=85046&side=provider×tamp=1543046581046 to registry registry://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=dubbo-provider-demo&dubbo=2.6.2&pid=85046®istry=zookeeper×tamp=1543046581042, dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:03:01.195 INFO 85046 --- [ main] c.a.d.remoting.transport.AbstractServer : [DUBBO] Start NettyServer bind /0.0.0.0:12345, export /192.168.0.103:12345, dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:03:01.256 INFO 85046 --- [ main] o.a.c.f.imps.CuratorFrameworkImpl : Starting
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:zookeeper.version=3.4.9-1757313, built on 08/23/2016 06:50 GMT
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:host.name=192.168.0.103
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.version=1.8.0_92
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.vendor=Oracle Corporation
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.class.path=/Users/chenxin/Eclipse-Workspace/default/dubbo-provider-demo/target/classes:/Users/chenxin/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.0.6.RELEASE/spring-boot-starter-web-2.0.6.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/boot/spring-boot-starter/2.0.6.RELEASE/spring-boot-starter-2.0.6.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/boot/spring-boot/2.0.6.RELEASE/spring-boot-2.0.6.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.0.6.RELEASE/spring-boot-autoconfigure-2.0.6.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.0.6.RELEASE/spring-boot-starter-logging-2.0.6.RELEASE.jar:/Users/chenxin/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/chenxin/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/chenxin/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.10.0/log4j-to-slf4j-2.10.0.jar:/Users/chenxin/.m2/repository/org/apache/logging/log4j/log4j-api/2.10.0/log4j-api-2.10.0.jar:/Users/chenxin/.m2/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar:/Users/chenxin/.m2/repository/org/yaml/snakeyaml/1.19/snakeyaml-1.19.jar:/Users/chenxin/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.0.6.RELEASE/spring-boot-starter-json-2.0.6.RELEASE.jar:/Users/chenxin/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.7/jackson-databind-2.9.7.jar:/Users/chenxin/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/chenxin/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.7/jackson-core-2.9.7.jar:/Users/chenxin/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.7/jackson-datatype-jdk8-2.9.7.jar:/Users/chenxin/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.7/jackson-datatype-jsr310-2.9.7.jar:/Users/chenxin/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.7/jackson-module-parameter-names-2.9.7.jar:/Users/chenxin/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.13.Final/hibernate-validator-6.0.13.Final.jar:/Users/chenxin/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar:/Users/chenxin/.m2/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar:/Users/chenxin/.m2/repository/com/fasterxml/classmate/1.3.4/classmate-1.3.4.jar:/Users/chenxin/.m2/repository/org/springframework/spring-web/5.0.10.RELEASE/spring-web-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/spring-beans/5.0.10.RELEASE/spring-beans-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/spring-webmvc/5.0.10.RELEASE/spring-webmvc-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/spring-aop/5.0.10.RELEASE/spring-aop-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/spring-context/5.0.10.RELEASE/spring-context-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/spring-expression/5.0.10.RELEASE/spring-expression-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.0.6.RELEASE/spring-boot-starter-tomcat-2.0.6.RELEASE.jar:/Users/chenxin/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar:/Users/chenxin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.34/tomcat-embed-core-8.5.34.jar:/Users/chenxin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.5.34/tomcat-embed-el-8.5.34.jar:/Users/chenxin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.34/tomcat-embed-websocket-8.5.34.jar:/Users/chenxin/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/Users/chenxin/.m2/repository/org/springframework/spring-core/5.0.10.RELEASE/spring-core-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/spring-jcl/5.0.10.RELEASE/spring-jcl-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/com/alibaba/boot/dubbo-spring-boot-starter/0.2.0/dubbo-spring-boot-starter-0.2.0.jar:/Users/chenxin/.m2/repository/com/alibaba/dubbo/2.6.2/dubbo-2.6.2.jar:/Users/chenxin/.m2/repository/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA.jar:/Users/chenxin/.m2/repository/org/jboss/netty/netty/3.2.5.Final/netty-3.2.5.Final.jar:/Users/chenxin/.m2/repository/org/apache/zookeeper/zookeeper/3.4.9/zookeeper-3.4.9.jar:/Users/chenxin/.m2/repository/jline/jline/0.9.94/jline-0.9.94.jar:/Users/chenxin/.m2/repository/io/netty/netty/3.10.5.Final/netty-3.10.5.Final.jar:/Users/chenxin/.m2/repository/org/apache/curator/curator-framework/2.12.0/curator-framework-2.12.0.jar:/Users/chenxin/.m2/repository/org/apache/curator/curator-client/2.12.0/curator-client-2.12.0.jar:/Users/chenxin/.m2/repository/com/google/guava/guava/16.0.1/guava-16.0.1.jar:/Users/chenxin/.m2/repository/com/alibaba/boot/dubbo-spring-boot-autoconfigure/0.2.0/dubbo-spring-boot-autoconfigure-0.2.0.jar
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.library.path=/Users/chenxin/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.io.tmpdir=/var/folders/pz/1sq2sn2922d0bzrpycsht1d40000gn/T/
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.compiler=<NA>
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.name=Mac OS X
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.arch=x86_64
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.version=10.14.1
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.name=chenxin
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.home=/Users/chenxin
2018-11-24 16:03:01.278 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.dir=/Users/chenxin/Eclipse-Workspace/default/dubbo-provider-demo
2018-11-24 16:03:01.279 INFO 85046 --- [ main] org.apache.zookeeper.ZooKeeper : Initiating client connection, connectString=127.0.0.1:2181 sessionTimeout=60000 watcher=org.apache.curator.ConnectionState@7c4fc2bf
2018-11-24 16:03:01.289 INFO 85046 --- [127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn : Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-24 16:03:01.291 INFO 85046 --- [ main] c.a.d.r.zookeeper.ZookeeperRegistry : [DUBBO] Register: dubbo://192.168.0.103:12345/com.ms.dubbo.service.HelloService?anyhost=true&application=dubbo-provider-demo&dubbo=2.6.2&generic=false&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=85046&side=provider×tamp=1543046581046, dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:03:01.295 INFO 85046 --- [127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn : Socket connection established to 127.0.0.1/127.0.0.1:2181, initiating session
2018-11-24 16:03:01.301 INFO 85046 --- [127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn : Session establishment complete on server 127.0.0.1/127.0.0.1:2181, sessionid = 0x1001b1fefc40002, negotiated timeout = 40000
2018-11-24 16:03:01.304 INFO 85046 --- [ain-EventThread] o.a.c.f.state.ConnectionStateManager : State change: CONNECTED
2018-11-24 16:03:01.319 INFO 85046 --- [ main] c.a.d.r.zookeeper.ZookeeperRegistry : [DUBBO] Subscribe: provider://192.168.0.103:12345/com.ms.dubbo.service.HelloService?anyhost=true&application=dubbo-provider-demo&category=configurators&check=false&dubbo=2.6.2&generic=false&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=85046&side=provider×tamp=1543046581046, dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:03:01.327 INFO 85046 --- [ main] c.a.d.r.zookeeper.ZookeeperRegistry : [DUBBO] Notify urls for subscribe url provider://192.168.0.103:12345/com.ms.dubbo.service.HelloService?anyhost=true&application=dubbo-provider-demo&category=configurators&check=false&dubbo=2.6.2&generic=false&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=85046&side=provider×tamp=1543046581046, urls: [empty://192.168.0.103:12345/com.ms.dubbo.service.HelloService?anyhost=true&application=dubbo-provider-demo&category=configurators&check=false&dubbo=2.6.2&generic=false&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=85046&side=provider×tamp=1543046581046], dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:03:01.350 INFO 85046 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 9090 (http) with context path ''
2018-11-24 16:03:01.354 INFO 85046 --- [ main] com.ms.DubboProviderDemoApplication : Started DubboProviderDemoApplication in 2.271 seconds (JVM running for 2.738)
启动consumer
使用run as->spring boot app启动:
2018-11-24 16:06:28.381 INFO 85077 --- [ main] c.a.dubbo.common.logger.LoggerFactory : using logger: com.alibaba.dubbo.common.logger.slf4j.Slf4jLoggerAdapter
2018-11-24 16:06:28.385 INFO 85077 --- [ main] a.b.d.c.e.WelcomeLogoApplicationListener :
:: Dubbo Spring Boot (v0.2.0) : https://github.com/apache/incubator-dubbo-spring-boot-project
:: Dubbo (v2.6.2) : https://github.com/apache/incubator-dubbo
:: Google group : dev@dubbo.incubator.apache.org
2018-11-24 16:06:28.387 INFO 85077 --- [ main] e.OverrideDubboConfigApplicationListener : Dubbo Config was overridden by externalized configuration {dubbo.application.id=dubbo-consumer-demo, dubbo.application.name=dubbo-consumer-demo, dubbo.protocol.id=dubbo, dubbo.protocol.name=dubbo, dubbo.protocol.port=12345, dubbo.registry.address=zookeeper://127.0.0.1:2181}
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.6.RELEASE)
2018-11-24 16:06:28.476 INFO 85077 --- [ main] com.ms.DubboConsumerDemoApplication : Starting DubboConsumerDemoApplication on MacBookPro with PID 85077 (/Users/chenxin/Eclipse-Workspace/default/dubbo-consumer-demo/target/classes started by chenxin in /Users/chenxin/Eclipse-Workspace/default/dubbo-consumer-demo)
2018-11-24 16:06:28.477 INFO 85077 --- [ main] com.ms.DubboConsumerDemoApplication : No active profile set, falling back to default profiles: default
2018-11-24 16:06:28.515 INFO 85077 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@5e316c74: startup date [Sat Nov 24 16:06:28 CST 2018]; root of context hierarchy
2018-11-24 16:06:28.881 INFO 85077 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The dubbo config bean definition [name : dubbo-consumer-demo, class : com.alibaba.dubbo.config.ApplicationConfig] has been registered.
2018-11-24 16:06:28.882 INFO 85077 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The BeanPostProcessor bean definition [com.alibaba.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor] for dubbo config bean [name : dubbo-consumer-demo] has been registered.
2018-11-24 16:06:28.882 INFO 85077 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The dubbo config bean definition [name : com.alibaba.dubbo.config.RegistryConfig#0, class : com.alibaba.dubbo.config.RegistryConfig] has been registered.
2018-11-24 16:06:28.882 INFO 85077 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The BeanPostProcessor bean definition [com.alibaba.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor] for dubbo config bean [name : com.alibaba.dubbo.config.RegistryConfig#0] has been registered.
2018-11-24 16:06:28.882 INFO 85077 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The dubbo config bean definition [name : dubbo, class : com.alibaba.dubbo.config.ProtocolConfig] has been registered.
2018-11-24 16:06:28.882 INFO 85077 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The BeanPostProcessor bean definition [com.alibaba.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor] for dubbo config bean [name : dubbo] has been registered.
2018-11-24 16:06:29.074 INFO 85077 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.alibaba.boot.dubbo.autoconfigure.DubboAutoConfiguration' of type [com.alibaba.boot.dubbo.autoconfigure.DubboAutoConfiguration$$EnhancerBySpringCGLIB$$8630ca83] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-11-24 16:06:29.126 INFO 85077 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'relaxedDubboConfigBinder' of type [com.alibaba.boot.dubbo.autoconfigure.RelaxedDubboConfigBinder] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-11-24 16:06:29.128 INFO 85077 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'relaxedDubboConfigBinder' of type [com.alibaba.boot.dubbo.autoconfigure.RelaxedDubboConfigBinder] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-11-24 16:06:29.129 INFO 85077 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'relaxedDubboConfigBinder' of type [com.alibaba.boot.dubbo.autoconfigure.RelaxedDubboConfigBinder] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-11-24 16:06:29.461 INFO 85077 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2018-11-24 16:06:29.483 INFO 85077 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-11-24 16:06:29.484 INFO 85077 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.34
2018-11-24 16:06:29.494 INFO 85077 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/chenxin/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2018-11-24 16:06:29.581 INFO 85077 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-11-24 16:06:29.581 INFO 85077 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1068 ms
2018-11-24 16:06:29.631 INFO 85077 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-11-24 16:06:29.634 INFO 85077 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-11-24 16:06:29.634 INFO 85077 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-11-24 16:06:29.634 INFO 85077 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-11-24 16:06:29.634 INFO 85077 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-11-24 16:06:29.788 INFO 85077 --- [ main] .f.a.DubboConfigBindingBeanPostProcessor : The properties of bean [name : dubbo-consumer-demo] have been binding by prefix of configuration properties : dubbo.application
2018-11-24 16:06:29.797 INFO 85077 --- [ main] .f.a.DubboConfigBindingBeanPostProcessor : The properties of bean [name : com.alibaba.dubbo.config.RegistryConfig#0] have been binding by prefix of configuration properties : dubbo.registry
2018-11-24 16:06:29.838 INFO 85077 --- [ main] c.a.d.r.zookeeper.ZookeeperRegistry : [DUBBO] Load registry store file /Users/chenxin/.dubbo/dubbo-registry-dubbo-consumer-demo-127.0.0.1:2181.cache, data: {com.ms.dubbo.service.HelloService=empty://192.168.0.103/com.ms.dubbo.service.HelloService?application=dubbo-consumer-demo&category=configurators&dubbo=2.6.2&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=84802&side=consumer×tamp=1543045556527 empty://192.168.0.103/com.ms.dubbo.service.HelloService?application=dubbo-consumer-demo&category=routers&dubbo=2.6.2&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=84802&side=consumer×tamp=1543045556527 empty://192.168.0.103/com.ms.dubbo.service.HelloService?application=dubbo-consumer-demo&category=providers&dubbo=2.6.2&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=84802&side=consumer×tamp=1543045556527}, dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:06:29.938 INFO 85077 --- [ main] o.a.c.f.imps.CuratorFrameworkImpl : Starting
2018-11-24 16:06:29.959 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:zookeeper.version=3.4.9-1757313, built on 08/23/2016 06:50 GMT
2018-11-24 16:06:29.959 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:host.name=192.168.0.103
2018-11-24 16:06:29.959 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.version=1.8.0_92
2018-11-24 16:06:29.959 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.vendor=Oracle Corporation
2018-11-24 16:06:29.959 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre
2018-11-24 16:06:29.959 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.class.path=/Users/chenxin/Eclipse-Workspace/default/dubbo-consumer-demo/target/classes:/Users/chenxin/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.0.6.RELEASE/spring-boot-starter-web-2.0.6.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/boot/spring-boot-starter/2.0.6.RELEASE/spring-boot-starter-2.0.6.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/boot/spring-boot/2.0.6.RELEASE/spring-boot-2.0.6.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.0.6.RELEASE/spring-boot-autoconfigure-2.0.6.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.0.6.RELEASE/spring-boot-starter-logging-2.0.6.RELEASE.jar:/Users/chenxin/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/chenxin/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/chenxin/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.10.0/log4j-to-slf4j-2.10.0.jar:/Users/chenxin/.m2/repository/org/apache/logging/log4j/log4j-api/2.10.0/log4j-api-2.10.0.jar:/Users/chenxin/.m2/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar:/Users/chenxin/.m2/repository/org/yaml/snakeyaml/1.19/snakeyaml-1.19.jar:/Users/chenxin/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.0.6.RELEASE/spring-boot-starter-json-2.0.6.RELEASE.jar:/Users/chenxin/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.7/jackson-databind-2.9.7.jar:/Users/chenxin/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/chenxin/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.7/jackson-core-2.9.7.jar:/Users/chenxin/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.7/jackson-datatype-jdk8-2.9.7.jar:/Users/chenxin/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.7/jackson-datatype-jsr310-2.9.7.jar:/Users/chenxin/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.7/jackson-module-parameter-names-2.9.7.jar:/Users/chenxin/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.13.Final/hibernate-validator-6.0.13.Final.jar:/Users/chenxin/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar:/Users/chenxin/.m2/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar:/Users/chenxin/.m2/repository/com/fasterxml/classmate/1.3.4/classmate-1.3.4.jar:/Users/chenxin/.m2/repository/org/springframework/spring-web/5.0.10.RELEASE/spring-web-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/spring-beans/5.0.10.RELEASE/spring-beans-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/spring-webmvc/5.0.10.RELEASE/spring-webmvc-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/spring-aop/5.0.10.RELEASE/spring-aop-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/spring-context/5.0.10.RELEASE/spring-context-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/spring-expression/5.0.10.RELEASE/spring-expression-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.0.6.RELEASE/spring-boot-starter-tomcat-2.0.6.RELEASE.jar:/Users/chenxin/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar:/Users/chenxin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.34/tomcat-embed-core-8.5.34.jar:/Users/chenxin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.5.34/tomcat-embed-el-8.5.34.jar:/Users/chenxin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.34/tomcat-embed-websocket-8.5.34.jar:/Users/chenxin/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/Users/chenxin/.m2/repository/org/springframework/spring-core/5.0.10.RELEASE/spring-core-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/org/springframework/spring-jcl/5.0.10.RELEASE/spring-jcl-5.0.10.RELEASE.jar:/Users/chenxin/.m2/repository/com/alibaba/boot/dubbo-spring-boot-starter/0.2.0/dubbo-spring-boot-starter-0.2.0.jar:/Users/chenxin/.m2/repository/com/alibaba/dubbo/2.6.2/dubbo-2.6.2.jar:/Users/chenxin/.m2/repository/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA.jar:/Users/chenxin/.m2/repository/org/jboss/netty/netty/3.2.5.Final/netty-3.2.5.Final.jar:/Users/chenxin/.m2/repository/org/apache/zookeeper/zookeeper/3.4.9/zookeeper-3.4.9.jar:/Users/chenxin/.m2/repository/jline/jline/0.9.94/jline-0.9.94.jar:/Users/chenxin/.m2/repository/io/netty/netty/3.10.5.Final/netty-3.10.5.Final.jar:/Users/chenxin/.m2/repository/org/apache/curator/curator-framework/2.12.0/curator-framework-2.12.0.jar:/Users/chenxin/.m2/repository/org/apache/curator/curator-client/2.12.0/curator-client-2.12.0.jar:/Users/chenxin/.m2/repository/com/google/guava/guava/16.0.1/guava-16.0.1.jar:/Users/chenxin/.m2/repository/com/alibaba/boot/dubbo-spring-boot-autoconfigure/0.2.0/dubbo-spring-boot-autoconfigure-0.2.0.jar
2018-11-24 16:06:29.959 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.library.path=/Users/chenxin/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
2018-11-24 16:06:29.959 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.io.tmpdir=/var/folders/pz/1sq2sn2922d0bzrpycsht1d40000gn/T/
2018-11-24 16:06:29.959 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.compiler=<NA>
2018-11-24 16:06:29.959 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.name=Mac OS X
2018-11-24 16:06:29.959 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.arch=x86_64
2018-11-24 16:06:29.959 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.version=10.14.1
2018-11-24 16:06:29.959 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.name=chenxin
2018-11-24 16:06:29.959 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.home=/Users/chenxin
2018-11-24 16:06:29.960 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.dir=/Users/chenxin/Eclipse-Workspace/default/dubbo-consumer-demo
2018-11-24 16:06:29.960 INFO 85077 --- [ main] org.apache.zookeeper.ZooKeeper : Initiating client connection, connectString=127.0.0.1:2181 sessionTimeout=60000 watcher=org.apache.curator.ConnectionState@261d8190
2018-11-24 16:06:29.977 INFO 85077 --- [127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn : Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-24 16:06:29.990 INFO 85077 --- [ main] c.a.d.r.zookeeper.ZookeeperRegistry : [DUBBO] Register: consumer://192.168.0.103/com.ms.dubbo.service.HelloService?application=dubbo-consumer-demo&category=consumers&check=false&dubbo=2.6.2&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=85077&side=consumer×tamp=1543046789800, dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:06:29.994 INFO 85077 --- [127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn : Socket connection established to 127.0.0.1/127.0.0.1:2181, initiating session
2018-11-24 16:06:30.000 INFO 85077 --- [127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn : Session establishment complete on server 127.0.0.1/127.0.0.1:2181, sessionid = 0x1001b1fefc40003, negotiated timeout = 40000
2018-11-24 16:06:30.003 INFO 85077 --- [ain-EventThread] o.a.c.f.state.ConnectionStateManager : State change: CONNECTED
2018-11-24 16:06:30.016 INFO 85077 --- [ main] c.a.d.r.zookeeper.ZookeeperRegistry : [DUBBO] Subscribe: consumer://192.168.0.103/com.ms.dubbo.service.HelloService?application=dubbo-consumer-demo&category=providers,configurators,routers&dubbo=2.6.2&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=85077&side=consumer×tamp=1543046789800, dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:06:30.028 INFO 85077 --- [ main] c.a.d.r.zookeeper.ZookeeperRegistry : [DUBBO] Notify urls for subscribe url consumer://192.168.0.103/com.ms.dubbo.service.HelloService?application=dubbo-consumer-demo&category=providers,configurators,routers&dubbo=2.6.2&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=85077&side=consumer×tamp=1543046789800, urls: [dubbo://192.168.0.103:12345/com.ms.dubbo.service.HelloService?anyhost=true&application=dubbo-provider-demo&dubbo=2.6.2&generic=false&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=85046&side=provider×tamp=1543046581046, empty://192.168.0.103/com.ms.dubbo.service.HelloService?application=dubbo-consumer-demo&category=configurators&dubbo=2.6.2&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=85077&side=consumer×tamp=1543046789800, empty://192.168.0.103/com.ms.dubbo.service.HelloService?application=dubbo-consumer-demo&category=routers&dubbo=2.6.2&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=85077&side=consumer×tamp=1543046789800], dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:06:30.101 INFO 85077 --- [ main] c.a.d.remoting.transport.AbstractClient : [DUBBO] Successed connect to server /192.168.0.103:12345 from NettyClient 192.168.0.103 using dubbo version 2.6.2, channel is NettyChannel [channel=[id: 0x7923f5b3, /192.168.0.103:55577 => /192.168.0.103:12345]], dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:06:30.101 INFO 85077 --- [ main] c.a.d.remoting.transport.AbstractClient : [DUBBO] Start NettyClient MacBookPro/192.168.0.103 connect to the server /192.168.0.103:12345, dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:06:30.132 INFO 85077 --- [ main] com.alibaba.dubbo.config.AbstractConfig : [DUBBO] Refer dubbo service com.ms.dubbo.service.HelloService from url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?anyhost=true&application=dubbo-consumer-demo&check=false&dubbo=2.6.2&generic=false&interface=com.ms.dubbo.service.HelloService&methods=sayHello&pid=85077®ister.ip=192.168.0.103&remote.timestamp=1543046581046&side=consumer×tamp=1543046789800, dubbo version: 2.6.2, current host: 192.168.0.103
2018-11-24 16:06:30.138 INFO 85077 --- [ main] c.a.d.c.s.b.f.a.ReferenceBeanBuilder : <dubbo:reference object="com.alibaba.dubbo.common.bytecode.proxy0@69c93ca4" singleton="true" interface="com.ms.dubbo.service.HelloService" uniqueServiceName="com.ms.dubbo.service.HelloService" generic="false" id="com.ms.dubbo.service.HelloService" /> has been built.
2018-11-24 16:06:30.199 INFO 85077 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-24 16:06:30.315 INFO 85077 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@5e316c74: startup date [Sat Nov 24 16:06:28 CST 2018]; root of context hierarchy
2018-11-24 16:06:30.367 INFO 85077 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/say]}" onto public java.lang.String com.ms.controller.HelloController.sayHello(java.lang.String)
2018-11-24 16:06:30.371 INFO 85077 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-11-24 16:06:30.372 INFO 85077 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-11-24 16:06:30.391 INFO 85077 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-24 16:06:30.391 INFO 85077 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-24 16:06:30.439 INFO 85077 --- [ main] .f.a.DubboConfigBindingBeanPostProcessor : The properties of bean [name : dubbo] have been binding by prefix of configuration properties : dubbo.protocol
2018-11-24 16:06:30.512 INFO 85077 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-11-24 16:06:30.538 INFO 85077 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2018-11-24 16:06:30.542 INFO 85077 --- [ main] com.ms.DubboConsumerDemoApplication : Started DubboConsumerDemoApplication in 2.324 seconds (JVM running for 2.814)
浏览器访问
2个服务都启动成功以后,可以打开浏览器访问http://127.0.0.1:8080/say?name=iengchen
,如果界面显示hello,iengchen
说明一切正常。
网友评论