[apache/dubbo]建议设置默认序列化为java原生序列化方法

2024-05-30 900 views
0

hessian2序列化老是存在各种问题,改为原生序列化之后,健壮很多。

回答

7

报错信息,能贴给我们看看么

0

WARN - DecodeableRpcInvocation - [DUBBO] Decode argument failed: 'sun.reflect.annotation.AnnotationInvocationHandler' could not be instantiated, dubbo version: 2.5.3, current host: 127.0.0.1 com.alibaba.com.caucho.hessian.io.HessianProtocolException: 'sun.reflect.annotation.AnnotationInvocationHandler' could not be instantiated at com.alibaba.com.caucho.hessian.io.JavaDeserializer.instantiate(JavaDeserializer.java:275) at com.alibaba.com.caucho.hessian.io.JavaDeserializer.readObject(JavaDeserializer.java:155) at com.alibaba.com.caucho.hessian.io.SerializerFactory.readObject(SerializerFactory.java:397) at com.alibaba.com.caucho.hessian.io.Hessian2Input.readObjectInstance(Hessian2Input.java:2070) at com.alibaba.com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2005) at com.alibaba.com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1990) at com.alibaba.com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1538) at com.alibaba.dubbo.common.serialize.support.hessian.Hessian2ObjectInput.readObject(Hessian2ObjectInput.java:94) at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:109) at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:71) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:137) at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:126) at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:87) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:46) at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalDecoder.messageReceived(NettyCodecAdapter.java:134) at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261) at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349) at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200) at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.alibaba.com.caucho.hessian.io.JavaDeserializer.instantiate(JavaDeserializer.java:271) ... 27 more Caused by: java.lang.NullPointerException at sun.reflect.annotation.AnnotationInvocationHandler.(AnnotationInvocationHandler.java:47) ... 32 more server:Hello null 2:Tue Mar 29 19:21:29 CST 2016 WARN - ExchangeCodec - [DUBBO] Skip input stream 117, dubbo version: 2.5.3, current host: 127.0.0.1 WARN - AbstractServer - [DUBBO] All clients has discontected from /192.168.139.1:20880. You can graceful shutdown now., dubbo version: 2.5.3, current host: 127.0.0.1 INFO - DubboProtocol - [DUBBO] disconected from /192.168.139.1:59431,url:dubbo://192.168.139.1:20880/com.mor.server.dubbo.service.DemoServer?anyhost=true&application=hello-world-app&channel.readonly.sent=true&codec=dubbo&dubbo=2.5.3&heartbeat=60000&interface=com.mor.server.dubbo.service.DemoServer&methods=sayHello&pid=10556&side=provider&timestamp=1459244973763, dubbo version: 2.5.3, current host: 127.0.0.1

6

@OneSourceCat DemoServer 这个服务的代码

4

确实hessian序列化不太好

4

dubbo hessian序列化发现在父类子类存在同名字段的情况下,如果父类的值为null的话,子类的同名字段赋值都会被覆盖为null

1

serialization=“java”,好用多了

4

没发现过,是不是把hibernate对象传输了?

8

@teaey Bean(远程方法返回的Bean) ----result(List<Map<String, Object>>) --------如果上面的map里面放入个class键,值为对方没有的类名,会报错,有官方解释么? ----count(int) 类似这样: { "count": 1, "result": [ { "createTime": "2016-11-25 17:08:10", "status": 2, "class": "com.xxx.Xxx" } ] }

8

备注一下。

0

dubbo hessian序列化发现在父类子类存在同名字段的情况下,如果父类的值为null的话,子类的同名字段赋值都会被覆盖为null

This is fixed in latest version.

Now the kyro,fastjson serialization component is added