dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

Upgrading from Dubbo 2.7.3 to Dubbo 2.7.6: Serialization custom classTypes cannot pass

Open TotalForgot opened this issue 6 years ago • 0 comments

  • [x ] I have searched the issues of this repository and believe that this is not a duplicate.
  • [x ] I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.6
  • Operating System version: Mac OS 10.13.6
  • Java version: 1.8.0_202-b08 Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

We were using Dubbo 2.7.3 before upgrading to Dubbo 2.7.6 (the most recent release). As Dubbo does not support serialization of several classType (for instance, InputStream), we have implement our own serialization by extending the ObjectInput and ObjectOutput classes. It was working properly with Dubbo 2.7.3.

When we upgrade to Dubbo 2.7.6, the AsyncRpcResult.getAppResponse keeps failing at getting the response.

Our question is: Does we need to do more than implementing the de/serialization to make Dubbo support extra classtypes in our exporting APIs?

Stack trace

Exception in thread "main" org.apache.dubbo.rpc.RpcException: java.util.concurrent.ExecutionException: java.lang.RuntimeException
	at org.apache.dubbo.rpc.AsyncRpcResult.getAppResponse(AsyncRpcResult.java:151)
	at org.apache.dubbo.rpc.AsyncRpcResult.recreate(AsyncRpcResult.java:191)
	at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:74)
	at org.apache.dubbo.common.bytecode.proxy0.getFile(proxy0.java)
	at org.apache.dubbo.demo.consumer.Application.runWithBootstrap(Application.java:69)
	at org.apache.dubbo.demo.consumer.Application.main(Application.java:39)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException
	at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
	at org.apache.dubbo.rpc.AsyncRpcResult.getAppResponse(AsyncRpcResult.java:146)
	... 5 more
Caused by: java.lang.RuntimeException
	at org.apache.dubbo.common.utils.PojoUtils.newInstance(PojoUtils.java:559)
	at org.apache.dubbo.common.utils.PojoUtils.realize0(PojoUtils.java:452)
	at org.apache.dubbo.common.utils.PojoUtils.realize(PojoUtils.java:209)
	at org.apache.dubbo.rpc.filter.GenericImplFilter.onResponse(GenericImplFilter.java:166)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.lambda$invoke$0(ProtocolFilterWrapper.java:119)
	at org.apache.dubbo.rpc.AsyncRpcResult.lambda$whenCompleteWithContext$0(AsyncRpcResult.java:197)
	at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:760)
	at java.util.concurrent.CompletableFuture.uniWhenCompleteStage(CompletableFuture.java:778)
	at java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:2140)
	at org.apache.dubbo.rpc.AsyncRpcResult.whenCompleteWithContext(AsyncRpcResult.java:195)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:101)
	at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:89)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:81)
	at org.apache.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:51)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:81)
	at org.apache.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:55)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:81)
	at org.apache.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:78)
	at org.apache.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56)
	at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:82)
	at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:259)
	at org.apache.dubbo.rpc.cluster.interceptor.ClusterInterceptor.intercept(ClusterInterceptor.java:47)
	at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$InterceptorInvokerNode.invoke(AbstractCluster.java:92)
	at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:82)
	... 4 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.apache.dubbo.common.utils.PojoUtils.newInstance(PojoUtils.java:553)
	... 27 more
Caused by: java.lang.NullPointerException
	at java.io.FileInputStream.<init>(FileInputStream.java:168)
	... 32 more

We will try to create a quick github project so that you can reproduce the exception easily if you need to.

TotalForgot avatar Apr 07 '20 16:04 TotalForgot