首页 > 解决方案 > 使用网络引导程序运行时如何摆脱corda中的“未提供流会话”异常?

问题描述

我正在运行corda 4.5。使用 gradle 任务 deployNodes 运行时,我的流程运行良好。但是,当我为使用网络引导程序创建的节点运行流程时,我遇到了以下异常。

Mon Jul 26 12:43:10 GMT 2021>>> start CreateAccount name: accountOne

▶︎ Starting
    ✘ Requesting signature by notary service
        ✘ Requesting signature by Notary service
        ✘ Validating response from Notary service
    ✘ Broadcasting transaction to participants
✘ Done
☂ java.lang.IllegalArgumentException: Flow sessions were not provided for the following transaction participants: [O=PartyA, L=New York, C=US]

从日志中:

inMemoryConfigSelectionLogger. - Did not detect a configuration for InMemory selection - enabling memory usage for token indexing. Please set stateSelection.inMemory.enabled to "false" to disable this 
inMemoryConfigSelectionLogger. - No indexing method specified. Indexes will be created at run-time for each invocation of selectTokens - Cordapp configuration is incorrect due to exception - empty config: No configuration setting found for key 'stateSelection'

标签: blockchaincorda

解决方案


就像 Sneha 在评论中所说,如果没有更多关于这里代码的上下文,就不可能对这里问题的来源充满信心。

请记住,您希望确保流程会话以类似于您在列表中指定身份并将其提交到最终流程的方式提供。

        Party me = getOurIdentity();
        Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0);
        Command<YoContract.Commands.Send> command = new Command<YoContract.Commands.Send>(new YoContract.Commands.Send(), Arrays.asList(me.getOwningKey()));
        YoState state = new YoState(me, this.target);
        StateAndContract stateAndContract = new StateAndContract(state, YoContract.ID);
        TransactionBuilder utx = new TransactionBuilder(notary).withItems(stateAndContract, command);

        this.progressTracker.setCurrentStep(VERIFYING);
        utx.verify(getServiceHub());

        this.progressTracker.setCurrentStep(SIGNING);
        SignedTransaction stx = getServiceHub().signInitialTransaction(utx);

        this.progressTracker.setCurrentStep(FINALISING);
        FlowSession targetSession = initiateFlow(this.target);
        return subFlow(new FinalityFlow(stx, Collections.singletonList(targetSession), Objects.requireNonNull(FINALISING.childProgressTracker())));
    }

来源:https ://github.com/corda/samples-java/blob/master/Features/dockerform-yocordapp/workflows/src/main/java/net/corda/samples/dockerform/flows/YoFlow.java


推荐阅读