索引 0 {} 处缺少参数名称

missing parameter name at index 0 {}

我尝试为我自己的订单流程编写一个演示 - deliverydemo base on bootcamp-cordapp and refer cordapp-example。 甲丙方和公证人通过命令启动后 "build/nodes/runnodes":

  1. TokenIssueFlow 有效。
  2. 我可以在 CLI 中通过 "flow list" 命令查看我的订单流。 但是在尝试启动我的订单流程时得到 "missing parameter name at index 0 {}"。

Thu Jul 26 09:41:51 CST 2018>>> flow start OrderPlaceFlow$OrderPlaceRequestFlow buyer: PartyB, seller: PartyC, sellingPrice: 12.9, downPayments: 0.1 flow start OrderPlaceFlow$OrderPlaceRequestFlow buyer: PartyB, seller: PartyC, sellingPrice: 12.9, downPayments: 0.1: exception: Could not parse as a command: Method lambda$call missing parameter name at index 0 Thu Jul 26 09:41:55 CST 2018>>> E 09:41:55+0800 [pool-8-thread-8] command.CRaSHSession.execute - Error while evaluating request 'flow start OrderPlaceFlow$OrderPlaceRequestFlow buyer: PartyB, seller: PartyC, sellingPrice: 12.9, downPayments: 0.1' flow start OrderPlaceFlow$OrderPlaceRequestFlow buyer: PartyB, seller: PartyC, sellingPrice: 12.9, downPayments: 0.1: exception: Could not parse as a command: Method lambda$call missing parameter name at index 0 {} net.corda.client.jackson.StringToMethodCallParser$UnparseableCallException$ReflectionDataMissing: Could not parse as a command: Method lambda$call missing parameter name at index 0 at net.corda.client.jackson.StringToMethodCallParser.paramNamesFromMethod(StringToMethodCallParser.kt:131) ~[corda-jackson-corda-3.0.jar:?]


Thu Jul 26 09:38:32 CST 2018>>> flow list com.cienet.deliverydemo.order.OrderPlaceFlow$OrderPlaceRequestFlow com.cienet.deliverydemo.token.TokenIssueFlow net.corda.core.flows.ContractUpgradeFlow$Authorise net.corda.core.flows.ContractUpgradeFlow$Deauthorise net.corda.core.flows.ContractUpgradeFlow$Initiate

Thu Jul 26 09:38:34 CST 2018>>>


public OrderPlaceRequestFlow(Party buyer, Party seller, float sellingPrice, float downPayments) {
    this.buyer = buyer;
    this.seller = seller;
    this.sellingPrice = sellingPrice;
    this.downPayments = downPayments;
}

我仍然不知道为什么,但是在构建清理并通过以下方式重新构建后它正在工作:

./gradlew clean
./gradlew test
./gradlew deployNodesJava -Poffline=true

有时,这是一个重建问题。 但是,如果您对流程使用 JAVA,并使用会话 send/receive/unwarp,则会出现此错误。在 Kotlin 代码中不会发生。

编辑:

我为 sending/receiving StateAndRef.

添加了一个 Kotlin 代码
class TokenAsk(private val otherPartyFlow: FlowSession) {

@Suspendable
fun askTokenState(amount: Int, owner: Party): StateAndRef<TokenState> {
    otherPartyFlow.send(amount)
    otherPartyFlow.send(owner)
    return otherPartyFlow.receive<StateAndRef<TokenState>>().unwrap { it }
}

@Suspendable
fun receiveAmount(): Int =
    otherPartyFlow.receive<Int>().unwrap{it}

@Suspendable
fun receiveOwner(): Party =
        otherPartyFlow.receive<Party>().unwrap{it}

@Suspendable
fun sendStateAndRef(tokenStateAndRef: StateAndRef<TokenState>) =
    otherPartyFlow.send(tokenStateAndRef)

}

** 编辑 2 **

我在使用 Kotlin 代码时再次遇到此错误。 我必须删除 Flow 的构造函数中的 "private" 关键字以避免此错误。

发件人:

class Initiator(private val number: String, private val otherParty: Party) : FlowLogic<SignedTransaction>()

收件人:

class Initiator(val number: String, val otherParty: Party) : FlowLogic<SignedTransaction>()