apache / dubbo-spring-boot-project

Spring Boot Project for Apache Dubbo
https://dubbo.apache.org
Apache License 2.0
5.41k stars 1.88k forks source link

自定义Starter,Dubbo的版本信息不正确,消费者注册不进注册中心 #328

Closed jackieonway closed 5 years ago

jackieonway commented 5 years ago

自定义了一个Dubbo的Springboot starter ,但是在启动的过程中,Provider能注册进注册中心,但是Dubbo的版本信息不正确,我使用的是Dubbo 2.6.4但是通过Dubbo Admin查询到的是2.0.2版本,Consumer无法向注册中心注册。请大佬帮忙看看是怎么回事..项目地址:https://github.com/jackiehe2018/demo-springboot-starter-project ,

Provider Console 打印信息如下:

2018-12-13 09:48:25.034 INFO 11204 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.io.tmpdir=C:\Users\tiankai\AppData\Local\Temp\ 2018-12-13 09:48:25.034 INFO 11204 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.compiler= 2018-12-13 09:48:25.034 INFO 11204 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.name=Windows 7 2018-12-13 09:48:25.034 INFO 11204 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.arch=amd64 2018-12-13 09:48:25.034 INFO 11204 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.version=6.1 2018-12-13 09:48:25.034 INFO 11204 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.name=tiankai 2018-12-13 09:48:25.034 INFO 11204 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.home=C:\Users\tiankai 2018-12-13 09:48:25.034 INFO 11204 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.dir=E:\Code\demo-springboot-starter-project-master\trunk\demo-spring-boot-starter-project 2018-12-13 09:48:25.035 INFO 11204 --- [ main] org.apache.zookeeper.ZooKeeper : Initiating client connection, connectString=localhost:2181 sessionTimeout=60000 watcher=org.apache.curator.ConnectionState@1235151c 2018-12-13 09:48:25.078 INFO 11204 --- [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-12-13 09:48:25.079 INFO 11204 --- [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-12-13 09:48:25.229 INFO 11204 --- [127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn : Session establishment complete on server 127.0.0.1/127.0.0.1:2181, sessionid = 0x167a53d11f90001, negotiated timeout = 40000 2018-12-13 09:48:25.250 INFO 11204 --- [ain-EventThread] o.a.c.f.state.ConnectionStateManager : State change: CONNECTED 2018-12-13 09:48:25.764 INFO 11204 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8091 (http) with context path '' 2018-12-13 09:48:25.767 INFO 11204 --- [ main] c.e.s.p.DemoSimplesProviderApplication : Started DemoSimplesProviderApplication in 14.429 seconds (JVM running for 27.183)

Consumer Console 打印信息如下:

2018-12-13 09:48:55.559 INFO 9480 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2018-12-13 09:48:55.559 INFO 9480 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1908 ms 2018-12-13 09:48:55.654 INFO 9480 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/] 2018-12-13 09:48:55.658 INFO 9480 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/] 2018-12-13 09:48:55.659 INFO 9480 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/] 2018-12-13 09:48:55.659 INFO 9480 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'formContentFilter' to: [/] 2018-12-13 09:48:55.659 INFO 9480 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/] 2018-12-13 09:48:56.120 INFO 9480 --- [ main] c.e.d.a.DubboAutoConfiguration : =======init ApplicationConfig 2018-12-13 09:48:56.121 INFO 9480 --- [ main] c.e.d.a.DubboAutoConfiguration : ========config infomations: [ {"application":,"protocols":[],"monitor":null,"provider":null,"module":null,"method":null,"consumer":} ] 2018-12-13 09:48:56.130 INFO 9480 --- [ main] c.e.d.a.DubboAutoConfiguration : ========init ConsumerConfig 2018-12-13 09:48:56.137 INFO 9480 --- [ main] c.e.d.a.DubboAutoConfiguration : ========init MonitorConfig 2018-12-13 09:48:56.171 INFO 9480 --- [ main] c.a.d.c.s.b.f.a.ReferenceBeanBuilder : has been built. 2018-12-13 09:48:56.577 INFO 9480 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2018-12-13 09:48:56.940 INFO 9480 --- [ main] c.e.d.a.DubboAutoConfiguration : ========init List 2018-12-13 09:48:56.952 INFO 9480 --- [ main] c.e.d.a.DubboAutoConfiguration : ========init MethodConfig 2018-12-13 09:48:56.961 INFO 9480 --- [ main] c.e.d.a.DubboAutoConfiguration : ========init ProviderConfig 2018-12-13 09:48:57.696 INFO 9480 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8090 (http) with context path '' 2018-12-13 09:48:57.701 INFO 9480 --- [ main] c.e.s.c.DemoSimplesConsumerApplication : Started DemoSimplesConsumerApplication in 4.78 seconds (JVM running for 7.322)

感谢各位大佬了. qq 20181213100208

mercyblitz commented 5 years ago

You could add these dependencies to your pom.xml:


<!-- Dubbo -->
<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>dubbo</artifactId>
    <version>2.6.5</version>
</dependency>
<!-- Spring Context Extras -->
<dependency>
    <groupId>com.alibaba.spring</groupId>
    <artifactId>spring-context-support</artifactId>
    <version>1.0.2</version>
</dependency>