Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Blockchain by (12.7k points)

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:

enter image description here

1 Answer

0 votes
by (29.5k points)


Hi, asi can see, you are sending policy but the constructor expects something else. there is no constructor in that class that accepts a policy state. You've a constructor with 10 fields.

so I think you need tocheck the constructor of PolicyFlow$Initiator Class there is a mismatch in constructor:

Browse Categories

...