apache / apache/dubbo

在使用基于 IDL 方式,客户端和服务端合并部署在一个应用中使用injvm ,报java.lang.ClassCastException

Open
#10,910 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

dubbo 版本 3.1.1
配置:
dubbo:
application:
name: xxx
protocol:
name: injvm
consumer:
check: false

请求代码
LoginBySmsRequest.Builder builder = LoginBySmsRequest.newBuilder();
builder.
.setPhone(phone)
.setSmsCode(smsCode);
LoginReply reply = userLoginFacade.loginBySms(builder.build());

报错异常
java.lang.ClassCastException: com.xx.xx.user.facade.LoginBySmsRequest cannot be cast to com.xx.xx.user.facade.LoginReply
at com.xx.xx.user.facade.UserLoginFacadeDubboProxy1.loginBySms(UserLoginFacadeDubboProxy1.java) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) ~[spring-aop-5.3.22.jar:5.3.22]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) ~[spring-aop-5.3.22.jar:5.3.22]
at com.sun.proxy.$Proxy102.loginBySms(Unknown Source) ~[?:?]

Contributor guide

Open the contributing guide

Research direction

Start with the Dubbo 3.1.1 injvm configuration and the generated UserLoginFacadeDubboProxy1.loginBySms entry point shown in the stack trace. Reproduce the single-application IDL deployment using the provided request, then trace why LoginBySmsRequest is being cast to LoginReply. Done means the call returns a LoginReply without ClassCastException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.