corda / corda-solutions

Corda Solutions
28 stars 40 forks source link

IssueBillingStateFlow fails when called over RPC #127

Open mattbradburyuk opened 5 years ago

mattbradburyuk commented 5 years ago

I am trying to issue a BillingState using the following command over RPC, using the Corda-kotlin-shell:

val handle = bnoproxy.startFlowDynamic(IssueBillingStateFlow::class.java, aparty, 100L)

(where aparty is a Party on the Network)

The Corda-kotlin-shell returns this error: net.corda.nodeapi.exceptions.InternalNodeException: Something went wrong within the Corda node.

The bno node has this in the logs:

[ERROR] 2019-08-12T12:45:20,053Z [rpc-server-handler-pool-1] proxies.ExceptionMaskingRpcOpsProxy.log - Error during RPC invocation [errorCode=1p7l4gs, moreInformationAt=https://errors.corda.net/OS/4.0/1p7l4gs] {actor_id=user1, actor_owning_identity=O=BNO, L=London, C=GB, actor_store_id=NODE_CONFIG, invocation_id=59934bef-81c6-4344-8668-ac9de619037e, invocation_timestamp=2019-08-12T12:45:20.043Z, origin=user1, session_id=5bf95075-a0c8-4f70-8883-a712b9f10292, session_timestamp=2019-08-12T12:43:26.526Z} net.corda.core.flows.IllegalFlowLogicException: A FlowLogicRef cannot be constructed for FlowLogic of type com.r3.businessnetworks.billing.flows.bno.IssueBillingStateFlow: due to missing constructor for arguments: [class net.corda.core.identity.Party, class java.lang.Long] at net.corda.node.services.statemachine.FlowLogicRefFactoryImpl.createForRPC(FlowLogicRefFactoryImpl.kt:80) ~[corda-node-4.0.jar:?] at net.corda.node.internal.FlowStarterImpl.invokeFlowAsync(AbstractNode.kt:1054) ~[corda-node-4.0.jar:?] at net.corda.node.internal.CordaRPCOpsImpl.startFlow(CordaRPCOpsImpl.kt:197) ~[corda-node-4.0.jar:?] at net.corda.node.internal.CordaRPCOpsImpl.startFlowDynamic(CordaRPCOpsImpl.kt:188) ~[corda-node-4.0.jar:?] at net.corda.node.internal.rpc.proxies.AuthenticatedRpcOpsProxy$startFlowDynamic$2.invoke(AuthenticatedRpcOpsProxy.kt:26) ~[corda-node-4.0.jar:?] at net.corda.node.internal.rpc.proxies.AuthenticatedRpcOpsProxy$startFlowDynamic$2.invoke(AuthenticatedRpcOpsProxy.kt:15) ~[corda-node-4.0.jar:?] at net.corda.node.internal.rpc.proxies.AuthenticatedRpcOpsProxyKt.guard(AuthenticatedRpcOpsProxy.kt:52) ~[corda-node-4.0.jar:?] at net.corda.node.internal.rpc.proxies.AuthenticatedRpcOpsProxyKt.access$guard(AuthenticatedRpcOpsProxy.kt:1) ~[corda-node-4.0.jar:?] at net.corda.node.internal.rpc.proxies.AuthenticatedRpcOpsProxy.startFlowDynamic(AuthenticatedRpcOpsProxy.kt:25) ~[corda-node-4.0.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_192] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_192] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_192] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_192] at net.corda.node.internal.InvocationHandlerTemplate$DefaultImpls.invoke(InvocationHandlerTemplate.kt:16) ~[corda-node-4.0.jar:?] at net.corda.node.internal.rpc.proxies.ExceptionMaskingRpcOpsProxy$ErrorObfuscatingInvocationHandler.invoke(ExceptionMaskingRpcOpsProxy.kt:46) ~[corda-node-4.0.jar:?] at com.sun.proxy.$Proxy35.startFlowDynamic(Unknown Source) ~[?:?] at net.corda.node.internal.rpc.proxies.ExceptionMaskingRpcOpsProxy.startFlowDynamic(ExceptionMaskingRpcOpsProxy.kt) ~[corda-node-4.0.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_192] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_192] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_192] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_192] at net.corda.node.internal.InvocationHandlerTemplate$DefaultImpls.invoke(InvocationHandlerTemplate.kt:16) ~[corda-node-4.0.jar:?] at net.corda.node.internal.rpc.proxies.ExceptionSerialisingRpcOpsProxy$ErrorSerialisingInvocationHandler.invoke(ExceptionSerialisingRpcOpsProxy.kt:36) ~[corda-node-4.0.jar:?] at com.sun.proxy.$Proxy35.startFlowDynamic(Unknown Source) ~[?:?] at net.corda.node.internal.rpc.proxies.ExceptionSerialisingRpcOpsProxy.startFlowDynamic(ExceptionSerialisingRpcOpsProxy.kt) ~[corda-node-4.0.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_192] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_192] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_192] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_192] at net.corda.node.internal.InvocationHandlerTemplate$DefaultImpls.invoke(InvocationHandlerTemplate.kt:16) ~[corda-node-4.0.jar:?] at net.corda.node.internal.rpc.proxies.ThreadContextAdjustingRpcOpsProxy$ThreadContextAdjustingInvocationHandler$invoke$1.invoke(ThreadContextAdjustingRpcOpsProxy.kt:25) ~[corda-node-4.0.jar:?] at net.corda.core.internal.ClassLoadingUtilsKt.executeWithThreadContextClassLoader(ClassLoadingUtils.kt:36) ~[corda-core-4.0.jar:?] at net.corda.node.internal.rpc.proxies.ThreadContextAdjustingRpcOpsProxy$ThreadContextAdjustingInvocationHandler.invoke(ThreadContextAdjustingRpcOpsProxy.kt:25) ~[corda-node-4.0.jar:?] at com.sun.proxy.$Proxy35.startFlowDynamic(Unknown Source) ~[?:?] at net.corda.node.internal.rpc.proxies.ThreadContextAdjustingRpcOpsProxy.startFlowDynamic(ThreadContextAdjustingRpcOpsProxy.kt) ~[corda-node-4.0.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_192] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_192] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_192] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_192] at net.corda.node.services.rpc.RPCServer.invokeRpc(RPCServer.kt:360) ~[corda-node-4.0.jar:?] at net.corda.node.services.rpc.RPCServer.access$invokeRpc(RPCServer.kt:77) ~[corda-node-4.0.jar:?] at net.corda.node.services.rpc.RPCServer$clientArtemisMessageHandler$4.run(RPCServer.kt:333) ~[corda-node-4.0.jar:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_192] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_192] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_192] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_192] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_192] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_192] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_192]

The source code for the class is:

@StartableByRPC @InitiatingFlow class IssueBillingStateFlow(private val owner : Party, private val amount : Long, private val expiryDate : Instant? = null, private val category : String? = null) : FlowLogic<Pair<BillingState, SignedTransaction>>()

I believe the constructor is correct, because when I create the IssueBillingStateFlow in the Corda-kotlin-shell, it creates it correctly:

val ibsf = IssueBillingStateFlow(aparty, 100L) ibsf com.r3.businessnetworks.billing.flows.bno.IssueBillingStateFlow@7c9afc5c getClass(ibsf) class com.r3.businessnetworks.billing.flows.bno.IssueBillingStateFlow