Issue 1:
[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.

Issue 2:
I have searched the issues of this repository and believe that this is not a duplicate.

I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

Dubbo version: 2.7.1

Operating System version: Fedora 29

Java version: SE 11 (18.9)

Steps to reproduce this issue

Make service like this

@Service(interfaceClass = MessagingService.class, methods = {
@Method(name = "addMessageListener", arguments = {
@Argument(index = 0, callback = true)
})
})
public class MessagingServiceImpl implements MessagingService {

@Override
public void addMessageListener(MessageListener listener) {
//...
}
}

Call method addMessageListener on consumer side

Expected Result

No exceptions thrown

Actual Result

Throws IllegalStateException

Caused by: org.apache.dubbo.rpc.RpcException: Failed to invoke remote method: addMessageListener, provider: dubbo://127.0.0.1:20880/com.example.api.service.MessagingService?application=dubbo-spring-boot-starter&default.generic=false&default.lazy=false&default.sticky=false&dubbo=2.0.2&generic=false&interface=com.example.api.service.MessagingService&lazy=false&methods=addMessageListener&pid=5389&register.ip=192.168.1.103&revision=0.0.1-SNAPSHOT&side=consumer&sticky=false&timestamp=1563276164135, cause: io.netty.handler.codec.EncoderException: java.lang.IllegalStateException: Serialized class com.example.client.controller.MainController$1 must implement java.io.Serializable

io.netty.handler.codec.EncoderException: java.lang.IllegalStateException: Serialized class com.example.client.controller.MainController$1 must implement java.io.Serializable