尝试使用RPC连接Corda节点时出错

时间:2018-09-19 18:19:55

标签: corda

当我尝试从客户端建立RPC连接时,Node日志上出现以下异常。client.start()方法似乎被卡住了。代码如下。我正在Jetty托管的servlet中运行此代码。

        final NetworkHostAndPort nodeAddress = NetworkHostAndPort.parse("localhost:10008");
        final CordaRPCClient client = new CordaRPCClient(nodeAddress, CordaRPCClientConfiguration.DEFAULT);
        // Can be amended in the com.example.Main file.
        CordaRPCConnection clientConn= client.start("user1","password");

        rpcOps =clientConn.getProxy();

        rpcOps.waitUntilNetworkReady();

以下是我在节点日志中看到的异常。

java.lang.NumberFormatException: null
at java.lang.Long.parseLong(Long.java:552) ~[?:1.8.0_171]
at java.lang.Long.valueOf(Long.java:803) ~[?:1.8.0_171]
at org.apache.activemq.artemis.utils.collections.TypedProperties.getLongProperty(TypedProperties.java:240) ~[artemis-commons-2.2.0.jar:2.2.0]
at org.apache.activemq.artemis.core.message.impl.CoreMessage.getLongProperty(CoreMessage.java:820) ~[artemis-core-client-2.2.0.jar:2.2.0]
at org.apache.activemq.artemis.core.message.impl.CoreMessage.getLongProperty(CoreMessage.java:826) ~[artemis-core-client-2.2.0.jar:2.2.0]
at net.corda.nodeapi.RPCApiKt.id(RPCApi.kt:353) ~[corda-node-api-3.2-corda.jar:?]
at net.corda.nodeapi.RPCApiKt.invocationId(RPCApi.kt:345) ~[corda-node-api-3.2-corda.jar:?]
at net.corda.nodeapi.RPCApiKt.replyId(RPCApi.kt:270) ~[corda-node-api-3.2-corda.jar:?]
at net.corda.nodeapi.RPCApi$ClientToServer$Companion.fromClientMessage(RPCApi.kt:153) ~[corda-node-api-3.2-corda.jar:?]
at net.corda.node.services.messaging.RPCServer.clientArtemisMessageHandler(RPCServer.kt:299) ~[corda-node-3.2-corda.jar:?]
at net.corda.node.services.messaging.RPCServer.access$clientArtemisMessageHandler(RPCServer.kt:79) ~[corda-node-3.2-corda.jar:?]
at net.corda.node.services.messaging.RPCServer$createRpcConsumer$1.invoke(RPCServer.kt:196) ~[corda-node-3.2-corda.jar:?]
at net.corda.node.services.messaging.RPCServer$createRpcConsumer$1.invoke(RPCServer.kt:79) ~[corda-node-3.2-corda.jar:?]
at net.corda.node.services.messaging.RPCServerKt$sam$MessageHandler$5b9bfc45.onMessage(RPCServer.kt) ~[corda-node-3.2-corda.jar:?]
at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:997) ~[artemis-core-client-2.2.0.jar:2.2.0]
at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:49) ~[artemis-core-client-2.2.0.jar:2.2.0]
at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1120) [artemis-core-client-2.2.0.jar:2.2.0]
at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:42) [artemis-commons-2.2.0.jar:2.2.0]
at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:31) [artemis-commons-2.2.0.jar:2.2.0]
at org.apache.activemq.artemis.utils.actors.ProcessorBase$ExecutorTask.run(ProcessorBase.java:53) [artemis-commons-2.2.0.jar:2.2.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_171]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_171]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]

1 个答案:

答案 0 :(得分:2)

我在测试中遇到了类似的问题,结果发现我的客户端库与服务器版本不同。错误日志显示服务器具有3.2。您在客户端上使用的RPC是什么版本?