问题
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