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

GenericService.$invoke Parameter support problem #2003

Closed ningyu1 closed 6 years ago

ningyu1 commented 6 years ago

char[] type parameter support issues.

Use Dubbo version: V2.6.2 (consumer and provider versions are the same) Use Protocol: dubbo Use Serialize: hessian2

Consumer debug information:

image image

Provider code:

public String sayHello(long[] num, int[] arg, char[] name);

Provider error:

2018-06-28 10:45:02.377 [DubboServerHandler-192.168.6.47:20880-thread-102] ERROR com.alibaba.dubbo.rpc.filter.ExceptionFilter -  [DUBBO] Got unchecked and undeclared exception which called by 192.168.6.47. service: com.jiuyescm.dubbo.test.api.MyClassService, method: sayHello, exception: java.lang.ClassCastException: java.lang.String cannot be cast to [C, dubbo version: 2.6.2, current host: 192.168.6.47
java.lang.ClassCastException: java.lang.String cannot be cast to [C
    at com.alibaba.dubbo.common.bytecode.Wrapper1.invokeMethod(Wrapper1.java) ~[dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:47) ~[dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:76) ~[dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:52) ~[dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56) ~[dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:62) ~[dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:72) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:105) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:103) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:96) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:172) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51) [dubbo-2.6.2.jar:2.6.2]
    at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:80) [dubbo-2.6.2.jar:2.6.2]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_45]
    at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]

Provider debug information:

image image

Consumer send message:

image image

Provider receive and decoded:

in is com.alibaba.dubbo.common.serialize.hessian2.Hessian2ObjectInput

image

diecui1202 commented 6 years ago

May be you need use the following values as the parameterTypes

You can try it out.

ningyu1 commented 6 years ago

@diecui1202 thanks. Tried it, but still reported the wrong.

diecui1202 commented 6 years ago

OK, let me check it out.

diecui1202 commented 6 years ago

@ningyu1 I got the same exception.

Sample is here: https://github.com/diecui1202/dubbo-samples/tree/samples-2.7.x/dubbo-samples-genericinvoke

zonghaishang commented 6 years ago

fixed, refer: https://github.com/apache/incubator-dubbo/commit/0882c83bb9c772966d57cbf161a60ec3633f1e1e

ningyu1 commented 6 years ago

@diecui1202 @zonghaishang thanks