运行流时,“上下文中无事务"错误 [英] `No transaction in context` error when running a flow

查看:40
本文介绍了运行流时,“上下文中无事务"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行Corda流时,出现以下错误:

When running a Corda flow, I receive the following error:

java.lang.IllegalStateException: No transaction in context

我该如何解决这个问题?

How can I solve this issue?

推荐答案

此问题可能是由于未能使用 @Suspendable 批注对从流中调用的函数进行批注引起的.这可以是 FlowLogic.call ,也可以是从 FlowLogic.call 内部调用的函数(例如,如果要重写此函数为 SignTransactionFlow.checkTransaction 调用 CollectSignaturesFlow )的一部分.

This issue is likely caused by a failure to annotate a function called from within a flow with the @Suspendable annotation. This could either be FlowLogic.call, or a function called from within FlowLogic.call (e.g. SignTransactionFlow.checkTransaction if you are overriding this function as part of a call to CollectSignaturesFlow).

如果使用以下命令行标志运行流测试:

If you run flow tests with the following command line flag:

-Dco.paralleluniverse.fibers.verifyInstrumentation=true

然后,如果缺失的注释会导致错误,则会将其突出显示.但是,这会减慢测试的运行速度.

Then the missing annotation will be highlighted if it causes an error. However, this will slow down the running of the tests.

这篇关于运行流时,“上下文中无事务"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆