apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.5k stars 26.43k forks source link

Consumer report NPE, can not get the remote reference instance. #1099

Closed hczc closed 6 years ago

hczc commented 6 years ago

我用Springboot整合dubbo,使用application.properties注解模式配置,如果提供者在消费者后面启动的话,消费端调用就会空指针

big-mouth-cn commented 6 years ago

我也正好遇到这个问题,而且不会重新注入,会一直空指针。

hczc commented 6 years ago

spring.dubbo.consumer.check=false 这个参数添加了但是没效果ReferenceConfig拿到的是空, 最终使用JVM参数解决的-Ddubbo.consumer.check=false,望dubbo团队回复下是什么原因导致的,谢谢!

mercyblitz commented 6 years ago

Please use @EnableDubbo and add @PropertySource("your-config.properties"), and

your-config.properties content:

dubbo.consumer.check=false

or wait for dubbo-spring-boot-starter that will be release soon.

coderzl commented 6 years ago

应该是注解没有生效,在你的boot启动类上打上@DubboComponentScan(basePackages = "cn.xxxx")的注解

chickenlj commented 6 years ago

@hczc Please use dubbo 2.5.8, and follow @mercyblitz 's advice or refer this example

chickenlj commented 6 years ago

If you still get this problem, please attach a demo project so we can reproduce it.