Closed ZAKLLL closed 3 years ago
callback类需要实现 java.io.Serializable
callback类需要实现 java.io.Serializable
对callbackListener 实现java.io.Serializable 如下
@GetMapping("/callback1/{id}")
public void callback1(@PathVariable String id) {
callbackService.addListener(id, new MyCallbackListener());
}
static class MyCallbackListener implements CallbackListener, Serializable {
@Override
public void changed(String msg) {
System.out.println(msg);
}
}
重新进行调用时抛出异常如下
2020-12-16 09:48:12.829 WARN 20980 --- [:18888-thread-6] o.a.d.r.p.dubbo.DecodeableRpcInvocation : [DUBBO] Decode argument failed: ObjectDeserializer[interface com.xxx.callback.CallbackListener], dubbo version: 2.7.8, current host: 172.23.16.1
java.lang.UnsupportedOperationException: ObjectDeserializer[interface com.xxx.callback.CallbackListener]
at com.alibaba.com.caucho.hessian.io.ObjectDeserializer.readObject(ObjectDeserializer.java:77) ~[dubbo-2.7.8.jar:2.7.8]
at com.alibaba.com.caucho.hessian.io.Hessian2Input.readObjectInstance(Hessian2Input.java:2848) ~[dubbo-2.7.8.jar:2.7.8]
at com.alibaba.com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2175) ~[dubbo-2.7.8.jar:2.7.8]
at com.alibaba.com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2104) ~[dubbo-2.7.8.jar:2.7.8]
at com.alibaba.com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2148) ~[dubbo-2.7.8.jar:2.7.8]
at com.alibaba.com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2104) ~[dubbo-2.7.8.jar:2.7.8]
at org.apache.dubbo.common.serialize.hessian2.Hessian2ObjectInput.readObject(Hessian2ObjectInput.java:101) ~[dubbo-2.7.8.jar:2.7.8]
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:143) [dubbo-2.7.8.jar:2.7.8]
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:80) [dubbo-2.7.8.jar:2.7.8]
at org.apache.dubbo.remoting.transport.DecodeHandler.decode(DecodeHandler.java:57) [dubbo-2.7.8.jar:2.7.8]
at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:44) [dubbo-2.7.8.jar:2.7.8]
at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57) [dubbo-2.7.8.jar:2.7.8]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]
服务端抛出回调参数为Null的NPE
Try it with the latest version, if you still have problems, you can reopen the issues
Environment
Steps to reproduce this issue
当我使用@DubboService,无法找到对应的方法,参数配置,是否有注解支持声明回调 直接调用会抛出回调参数需要被序列化的异常