IllegalFlowLogicException: A FlowLogicRef cannot be constructed for FlowLogic

两盒软妹~` 提交于 2019-12-11 06:19:34

问题


In my Corda I am trying to call a flow using RPC but I am getting this error while making the call to initiate the flow:

net.corda.core.flows.IllegalFlowLogicException: A FlowLogicRef cannot be constructed for FlowLogic of type com.example.flow.PolicyFlow$Initiator: due to missing constructor for arguments: [class com.example.state.PolicyState]

My Flow is shown in the snippet below:

 public SignedTransaction call() throws FlowException {
        class SignTxFlow extends SignTransactionFlow {
            private SignTxFlow(FlowSession otherPartyFlow, ProgressTracker progressTracker) {
                super(otherPartyFlow, progressTracker);
            }

            @Override
            protected void checkTransaction(SignedTransaction stx) {
                requireThat(require -> {
                    ContractState output = stx.getTx().getOutputs().get(0).getData();
                    require.using("This must be an Policy transaction.", output instanceof PolicyState);
                    PolicyState policy = (PolicyState) output;
                    require.using("I won't accept Policy without a first Name.", (!(policy.getFirstName().equals(""))));
                    return null;
                });
            }
        }

        return subFlow(new SignTxFlow(otherPartyFlow, SignTransactionFlow.Companion.tracker()));
    }

The Function for RPC Connection and initiating the flow is given below:

Can someone help me with this?


回答1:


Please check the constructor of PolicyFlow$Initiator Class there is a mismatch in constructor: you are sending policy but the constructor expects something else as I can see in code you provided in comments. there is no constructor in that class that accepts a policy state. You've a constructor with 10 fields.



来源:https://stackoverflow.com/questions/52054813/illegalflowlogicexception-a-flowlogicref-cannot-be-constructed-for-flowlogic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!