Closed
Description
JsonRpcServer
correctly resolves RPC requests for methods with any of the following parameter types:
- primitive types
String
List
Map
But not for methods with any other parameter types (actually, strangely it also works with Integer
and Double
, but not with Long
).
So, for example, a method that has a Set
or Date
parameter cannot be called through RPC via JsonRpcClient
and JsonRpcServer
. It results in the server returning the following "argument type mismatch"
error message:
{
"code":500,
"name":"JSONRPCError",
"message":"Internal Server Error",
"error":{
"localizedMessage":"argument type mismatch",
"cause":null,
"stackTrace":[
{
"fileName":"NativeMethodAccessorImpl.java",
"nativeMethod":true,
"methodName":"invoke0",
"className":"sun.reflect.NativeMethodAccessorImpl",
"lineNumber":-2
},
{
"fileName":"NativeMethodAccessorImpl.java",
"nativeMethod":false,
"methodName":"invoke",
"className":"sun.reflect.NativeMethodAccessorImpl",
"lineNumber":62
},
{
"fileName":"DelegatingMethodAccessorImpl.java",
"nativeMethod":false,
"methodName":"invoke",
"className":"sun.reflect.DelegatingMethodAccessorImpl",
"lineNumber":43
},
{
"fileName":"Method.java",
"nativeMethod":false,
"methodName":"invoke",
"className":"java.lang.reflect.Method",
"lineNumber":497
},
{
"fileName":"JsonRpcServer.java",
"nativeMethod":false,
"methodName":"doCall",
"className":"com.rabbitmq.tools.jsonrpc.JsonRpcServer",
"lineNumber":143
},
{
"fileName":"JsonRpcServer.java",
"nativeMethod":false,
"methodName":"handleStringCall",
"className":"com.rabbitmq.tools.jsonrpc.JsonRpcServer",
"lineNumber":103
},
{
"fileName":"StringRpcServer.java",
"nativeMethod":false,
"methodName":"handleCall",
"className":"com.rabbitmq.client.StringRpcServer",
"lineNumber":48
},
{
"fileName":"RpcServer.java",
"nativeMethod":false,
"methodName":"handleCall",
"className":"com.rabbitmq.client.RpcServer",
"lineNumber":182
},
{
"fileName":"RpcServer.java",
"nativeMethod":false,
"methodName":"handleCall",
"className":"com.rabbitmq.client.RpcServer",
"lineNumber":169
},
{
"fileName":"RpcServer.java",
"nativeMethod":false,
"methodName":"processRequest",
"className":"com.rabbitmq.client.RpcServer",
"lineNumber":154
},
{
"fileName":"RpcServer.java",
"nativeMethod":false,
"methodName":"mainloop",
"className":"com.rabbitmq.client.RpcServer",
"lineNumber":119
},
// Application specific classes...
],
"suppressed":[
],
"message":"argument type mismatch"
}
}
On the other hand, return values of any type are passed to the RPC client correctly. The issue occurs only if the method has parameter types other than any of the above basic types.
This has also been asked by someone else on StackOverflow.
Versions:
- amqp-client v5.3.0
- RabbitMQ v3.7.3