apache / dubbo

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

采用点对点直连方式,dubbo-samples-callback运行的时候报错 #5090

Closed kewang85 closed 3 years ago

kewang85 commented 5 years ago

采用点对点直连方式的时候,dubbo-samples-callback运行的时候报org.apache.dubbo.samples.callback.CallbackServiceIT$$Lambda$132/0x0000000801328440 must implement java.io.Serializable

Environment

Steps to reproduce this issue

  1. 将spring/callback-provider.xml中的registry修改为
  2. 将spring/callback-consumer.xml中的registry删掉,dubbo:reference中增加url="dubbo://127.0.0.1:20880"
  3. 启动provider再启动consumer

报如下异常: Caused by: java.lang.IllegalStateException: Serialized class org.apache.dubbo.samples.callback.CallbackServiceIT$$Lambda$132/0x0000000801328440 must implement java.io.Serializable at com.alibaba.com.caucho.hessian.io.SerializerFactory.getDefaultSerializer(SerializerFactory.java:401) at com.alibaba.com.caucho.hessian.io.SerializerFactory.getSerializer(SerializerFactory.java:375) at com.alibaba.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:389) at org.apache.dubbo.common.serialize.hessian2.Hessian2ObjectOutput.writeObject(Hessian2ObjectOutput.java:89) at org.apache.dubbo.rpc.protocol.dubbo.DubboCodec.encodeRequestData(DubboCodec.java:185) at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encodeRequest(ExchangeCodec.java:238) at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encode(ExchangeCodec.java:69) at org.apache.dubbo.rpc.protocol.dubbo.DubboCountCodec.encode(DubboCountCodec.java:40) at org.apache.dubbo.remoting.transport.netty4.NettyCodecAdapter$InternalEncoder.encode(NettyCodecAdapter.java:70) at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ... 24 more

LiosWong commented 5 years ago

I am running locally, no error

anLA7856 commented 5 years ago

你可以检查下 你的 provider 端是否配置了 callback 参数,如果没有配置,当consumer 从 注册中心读取数据时候,是不会再url中写入参数回调信息的,所以就回走Hessian 的setObject ,也就是会检查序列化。而匿名内部类没有实现序列化,所以报错。

CrazyHZM commented 3 years ago

No feedback for a long time, please close the issue temporarily. If there is still a problem, you can reopen it.