[dubbo 3.0.2] dubbo with spring-boot-web cant get available Invoker
- Dominant language
- Java
- Stars
- 41.6k
- Forks
- 26.4k
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 4
Description
- [x] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
- [x] I have checked the [FAQ](https://github.com/apache/dubbo/blob/master/FAQ.md) of this repository and believe that this is not a duplicate.
### Environment
* Dubbo version: 3.0.2
* Operating System version: macos
* Java version: 8
### Steps to reproduce this issue
1. use `dubbo-spring-boot-starter` and `spring-boot-starter-web` build producers and consumers.
2. first run producers
3. second run consumers
## Case 1 (correct)
run with unit test,everything is ok
```java
@org.junit.jupiter.api.Test
public void sayHello() {
try {
HelloReply helloReply = myServiceStub.sayHello(HelloRequest.newBuilder().setName("ssss").build());
System.out.println(helloReply);
} catch (Exception e) {
LocalDateTime now = LocalDateTime.now();
log.error("", e);
}
}
```
## Case 2 (error)
run with web controller, an error will occur
```java
@RestController
@RequestMapping("/test")
@Slf4j
public class TestController {
@DubboReference
private MyService myServiceStub;
@GetMapping
public Object test() {
log.info("------------test");
myServiceStub.sayHello(HelloRequest.newBuilder().build());
return "ok";
}
}
```
config like this
```
dubbo:
application:
name: ${spring.application.name}
registry:
address: zookeeper://127.0.0.1:2181
consumer:
timeout: 4000
check: true
```
if you disabled `dubbo.consumer.check` ,The error will occur at call time
>- version 3.0.1 is fine
>- https://github.com/EarthChen/dubbo-triple-demo/tree/dubbo3.0.2-bug
### Expected Result
good running
### Actual Result
the consumers cant get available Invoker and throw exception
If there is an exception, please attach the exception trace:
```
ava.lang.IllegalStateException: Failed to check the status of the service com.earthchen.rpc.lib.MyService. No provider available for the service com.earthchen.rpc.lib.MyService from the url dubbo://192.168.1.185/com.earthchen.rpc.lib.MyService?application=test-dubbo-consumer&check=true&dubbo=2.0.2&interface=com.earthchen.rpc.lib.MyService&metadata-type=remote&methods=sayHello,sayHelloAsync&pid=28374&qos.enable=false®ister.ip=192.168.1.185&release=3.0.2&revision=3.0.2&side=consumer&sticky=false&timeout=4000×tamp=1629297754008 to the consumer 192.168.1.185 use dubbo version 3.0.2
at org.apache.dubbo.config.ReferenceConfig.checkInvokerAvailable(ReferenceConfig.java:444) ~[dubbo-3.0.2.jar:3.0.2]
at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:337) ~[dubbo-3.0.2.jar:3.0.2]
at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:204) ~[dubbo-3.0.2.jar:3.0.2]
at org.apache.dubbo.config.utils.ReferenceConfigCache.lambda$get$3(ReferenceConfigCache.java:113) ~[dubbo-3.0.2.jar:3.0.2]
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:1.8.0_275]
at org.apache.dubbo.config.utils.ReferenceConfigCache.get(ReferenceConfigCache.java:112) ~[dubbo-3.0.2.jar:3.0.2]
at org.apache.dubbo.config.bootstrap.DubboBootstrap.lambda$referServices$12(DubboBootstrap.java:1459) ~[dubbo-3.0.2.jar:3.0.2]
at java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4707) ~[na:1.8.0_275]
at org.apache.dubbo.config.bootstrap.DubboBootstrap.referServices(DubboBootstrap.java:1438) ~[dubbo-3.0.2.jar:3.0.2]
at org.apache.dubbo.config.bootstrap.DubboBootstrap.doStart(DubboBootstrap.java:1153) ~[dubbo-3.0.2.jar:3.0.2]
at org.apache.dubbo.config.bootstrap.DubboBootstrap.start(DubboBootstrap.java:1119) ~[dubbo-3.0.2.jar:3.0.2]
at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onContextRefreshedEvent(DubboBootstrapApplicationListener.java:109) ~[dubbo-3.0.2.jar:3.0.2]
at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onApplicationContextEvent(DubboBootstrapApplicationListener.java:101) ~[dubbo-3.0.2.jar:3.0.2]
at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onApplicationEvent(DubboBootstrapApplicationListener.java:78) ~[dubbo-3.0.2.jar:3.0.2]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.2.15.RELEASE.jar:5.2.15.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.2.15.RELEASE.jar:5.2.15.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.2.15.RELEASE.jar:5.2.15.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404) ~[spring-context-5.2.15.RELEASE.jar:5.2.15.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:361) ~[spring-context-5.2.15.RELEASE.jar:5.2.15.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:898) ~[spring-context-5.2.15.RELEASE.jar:5.2.15.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:554) ~[spring-context-5.2.15.RELEASE.jar:5.2.15.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:755) [spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:402) [spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1247) [spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1236) [spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
at com.test.DubboConsumer.main(DubboConsumer.java:14) [main/:na]
```
Contributor guide
Assessment
This issue has not been assessed yet.