问题
When running a Corda flow, I receive the following error:
java.lang.IllegalStateException: No transaction in context
How can I solve this issue?
回答1:
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.
来源:https://stackoverflow.com/questions/48302454/no-transaction-in-context-error-when-running-a-flow