IllegalFlowLogicException:无法为FlowLogic构造FlowLogicRef [英] IllegalFlowLogicException: A FlowLogicRef cannot be constructed for FlowLogic
问题描述
在我的Corda中,我试图使用RPC调用流,但是在进行调用以初始化流时却出现此错误:
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:FlowLogicRef无法 为类型的FlowLogic构造 com.example.flow.PolicyFlow $ Initiator:由于缺少构造函数 参数:[class com.example.state.PolicyState]
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()));
}
RPC连接和启动流程的功能如下:
The Function for RPC Connection and initiating the flow is given below:
有人可以帮我吗?
推荐答案
请检查PolicyFlow$Initiator
类的构造函数构造函数不匹配:您正在发送policy
,但是构造函数期望其他内容,如我所见您在注释中提供的代码.该类中没有接受策略状态的构造函数.您有一个包含10个字段的构造函数.
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.
这篇关于IllegalFlowLogicException:无法为FlowLogic构造FlowLogicRef的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!