dubbo
dubbo copied to clipboard
[Bug] java.lang.ClassCastException: org.apache.dubbo.samples.proto.GreetResponse cannot be cast to java.util.concurrent.CompletableFuture
Pre-check
- [X] I am sure that all the content I provide is in English.
Search before asking
- [X] I had searched in the issues and found no similar issues.
ref: https://github.com/apache/dubbo/discussions/13914
Apache Dubbo Component
Java SDK (apache/dubbo)
Dubbo Version
Dubbo java: 3.2.11 Jdk: 1.8 OS: macos 14.2.1
Steps to reproduce this issue
when use async method in java client and go server application level service discovery
- start the nacos server
- start the go-server:go run server.go
- start the java-client:
CompletableFuture<GreetResponse> future = greetService.greetAsync(req);
GreetResponse greet = future.get();
Exception in thread "main" java.lang.ClassCastException: org.apache.dubbo.samples.proto.GreetResponse cannot be cast to java.util.concurrent.CompletableFuture
at org.apache.dubbo.samples.proto.DubboGreetServiceTriple$GreetServiceStub.greetAsync(DubboGreetServiceTriple.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.dubbo.config.spring.util.LazyTargetInvocationHandler.invoke(LazyTargetInvocationHandler.java:54)
at org.apache.dubbo.samples.proto.GreetServiceDubboProxy0.greetAsync(GreetServiceDubboProxy0.java)
at org.apache.dubbo.samples.Main.main(Main.java:26)
code is at: https://github.com/FoghostCn/dubbo-go-samples/blob/async-bug/service_discovery/service/java-client/src/main/java/org/apache/dubbo/samples/Main.java
What you expected to happen
async method invoke success
Anything else
No response
Are you willing to submit a pull request to fix on your own?
- [X] Yes I am willing to submit a pull request on my own!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct