Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider服务端配置serialization="kryo"自定义异常类抛错时消费端捕获不到 #4238

Closed
netsail opened this issue Jun 3, 2019 · 0 comments
Milestone

Comments

@netsail
Copy link

netsail commented Jun 3, 2019

provider 服务端配置 serialization="kryo" 自定义异常类抛错时,消费端 kryo 序列化后捕获不到异常,以下是报错信息:

method:org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.decode(DecodeableRpcResult.java:148)
 [DUBBO] Decode rpc result failed: com.esotericsoftware.kryo.KryoException: Class cannot be created (missing no-arg constructor): java.lang.StackTraceElementSerialization trace:stackTrace (org.apache.dubbo.rpc.RpcException), dubbo version: 2.7.0, current host: 127.0.0.1
java.io.IOException: com.esotericsoftware.kryo.KryoException: Class cannot be created missing no-arg constructor): java.lang.StackTraceElementSerialization trace:stackTrace (org.apache.dubbo.rpc.RpcException)

我们自己的解决方案是在 dubbo-serialization/dubbo-serialization-kryo/src/main/java/org/apache/dubbo/common/serialize/kryo/utils/AbstractKryoFactory.java 类中添加:

kryo.addDefaultSerializer(Throwable.class, new JavaSerializer());

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants