Corda 公证人 ClassNotFoundException:格式错误的交易,无法反序列化索引 0 处的 OUTPUTS_GROUP

Corda notary ClassNotFoundException : Malformed transaction, OUTPUTS_GROUP at index 0 cannot be deserialised

当两个节点之间 运行 一个 InitiatingFlow/InitiatedBy 时,我的公证节点抛出一个错误:java.lang.Exception: Malformed transaction, OUTPUTS_GROUP at index 0 cannot be deserialised 再往下一点:Caused by: java.lang.ClassNotFoundException: xxx.xxx.xxx.shared.states.OrderItemState

包括 'shared' 在我的公证处定义此状态的 CordApp 解决了这个问题,但我不明白为什么这是必要的?

我能够在不包括 CordApp 的情况下在节点之间来回发送其他状态 唯一的区别是 OrderItemStateLinearState 而其他的是 FungibleAsset,我要在那里寻找答案吗?

我假设您使用的是验证公证人。验证公证人是检查交易是否有效以及检查它是否不包含 double-spend 尝试的公证人。这在隐私方面是有代价的。参见 https://docs.corda.net/key-concepts-notaries.html#validation

如果你查看 NotaryFlow.Client 中将交易发送给公证人的代码,你可以看到验证公证人发送了整个交易,因此需要 CorDapp 在其 cordapps文件夹:

if (serviceHub.networkMapCache.isValidatingNotary(notaryParty)) {
    subFlow(SendTransactionWithRetry(session, stx))
    session.receive<List<TransactionSignature>>()
}