BNMS添加自定义元数据导致逆流错误

Adding custom metadata in BNMS causes counter flow error

在 BNMS 中添加自定义元数据时。我遇到错误。

 [ERROR] 2020-09-08T04:40:51,923Z [Node thread-1] transactions.TransactionBuilder. - The transaction currently built is missing an attachment for class: com/example/flows/dataClass/BNOMetadata.
                        Attempted to find a suitable attachment but could not find any in the storage.
                        Please contact the developer of the CorDapp for further instructions. {fiber-id=10000001, flow-id=26210376-f913-4759-a480-bae18b2847b0, invocation_id=9341077f-7c5f-4852-9c68-3897fc5025be, invocation_timestamp=2020-09-08T04:40:50.395Z, origin=O=PartyA, L=Tokyo, C=JP, session_id=9341077f-7c5f-4852-9c68-3897fc5025be, session_timestamp=2020-09-08T04:40:50.395Z, thread-id=196}
[INFO ] 2020-09-08T04:40:51,923Z [Node thread-1] corda.flow. - Removing the pending request from the database {fiber-id=10000001, flow-id=26210376-f913-4759-a480-bae18b2847b0, invocation_id=9341077f-7c5f-4852-9c68-3897fc5025be, invocation_timestamp=2020-09-08T04:40:50.395Z, origin=O=PartyA, L=Tokyo, C=JP, session_id=9341077f-7c5f-4852-9c68-3897fc5025be, session_timestamp=2020-09-08T04:40:50.395Z, thread-id=196}
[INFO ] 2020-09-08T04:40:51,940Z [Node thread-1] corda.flow. - Flow raised an error: Failed to deserialise group OUTPUTS_GROUP at index 0 in transaction: Internal deserialization failure: java.lang.ClassNotFoundException: com.example.flows.dataClass.BNOMetadata. Sending it to flow hospital to be triaged. {fiber-id=10000001, flow-id=26210376-f913-4759-a480-bae18b2847b0, invocation_id=9341077f-7c5f-4852-9c68-3897fc5025be, invocation_timestamp=2020-09-08T04:40:50.395Z, origin=O=PartyA, L=Tokyo, C=JP, session_id=9341077f-7c5f-4852-9c68-3897fc5025be, session_timestamp=2020-09-08T04:40:50.395Z, thread-id=196}
[INFO ] 2020-09-08T04:40:51,945Z [Node thread-1] statemachine.StaffedFlowHospital. - Flow [26210376-f913-4759-a480-bae18b2847b0] admitted to hospital in state StateMachineState(checkpoint=Checkpoint(invocationContext=InvocationContext(origin=Peer(party=O=PartyA, L=Tokyo, C=JP), trace=Trace(invocationId=9341077f-7c5f-4852-9c68-3897fc5025be, timestamp: 2020-09-08T04:40:50.395Z, entityType: Invocation, sessionId=9341077f-7c5f-4852-9c68-3897fc5025be, timestamp: 2020-09-08T04:40:50.395Z, entityType: Session), actor=null, externalTrace=null, impersonatedActor=null), ourIdentity=O=BNO, L=Tokyo, C=JP, sessions={SessionId(toLong=-5496602332043580286)=Initiated(peerParty=O=PartyA, L=Tokyo, C=JP, peerFlowInfo=FlowInfo(flowVersion=2, appName=membership-service-2.0), receivedMessages=[], initiatedState=Live(peerSinkSessionId=SessionId(toLong=-6333690044472704062)), errors=[], deduplicationSeed=D--6333690044472704062-3691563152744622828)}, subFlowStack=[Inlined(flowClass=class com.r3.businessnetworks.membership.flows.bno.RequestMembershipFlowResponder, subFlowVersion=CorDappFlow(platformVersion=7, corDappName=membership-service-2.0, corDappHash=8FF7CE72627FDF7EA750D1DE22C0328AEB363E17E0169A6938DA9C5F93AB923E), isEnabledTimedFlow=false)], flowState=Started(flowIORequest=Receive(sessions=[FlowSessionImpl(destination=O=PartyA, L=Tokyo, C=JP, sourceSessionId=SessionId(toLong=-5496602332043580286))]), frozenFiber=45711FFA01B46307ED47F4A051647F0B522694853E5040F182D98E726D273472), errorState=Clean, numberOfSuspends=1), flowLogic=com.r3.businessnetworks.membership.flows.bno.RequestMembershipFlowResponder@41bb1134, pendingDeduplicationHandlers=[], isFlowResumed=true, isWaitingForFuture=false, future=null, isAnyCheckpointPersisted=true, isStartIdempotent=false, isRemoved=false, isKilled=false, senderUUID=2f6073b4-c826-4869-a739-27594e558f4b) {fiber-id=10000001, flow-id=26210376-f913-4759-a480-bae18b2847b0, invocation_id=9341077f-7c5f-4852-9c68-3897fc5025be, invocation_timestamp=2020-09-08T04:40:50.395Z, origin=O=PartyA, L=Tokyo, C=JP, session_id=9341077f-7c5f-4852-9c68-3897fc5025be, session_timestamp=2020-09-08T04:40:50.395Z, thread-id=196}
[INFO ] 2020-09-08T04:40:51,948Z [Node thread-1] statemachine.StaffedFlowHospital. - Error 1 of 1: {fiber-id=10000001, flow-id=26210376-f913-4759-a480-bae18b2847b0, invocation_id=9341077f-7c5f-4852-9c68-3897fc5025be, invocation_timestamp=2020-09-08T04:40:50.395Z, origin=O=PartyA, L=Tokyo, C=JP, session_id=9341077f-7c5f-4852-9c68-3897fc5025be, session_timestamp=2020-09-08T04:40:50.395Z, thread-id=196}
net.corda.core.internal.TransactionDeserialisationException: Failed to deserialise group OUTPUTS_GROUP at index 0 in transaction: Internal deserialization failure: java.lang.ClassNotFoundException: com.example.flows.dataClass.BNOMetadata
    at net.corda.core.internal.TransactionUtilsKt$deserialiseComponentGroup.invoke(TransactionUtils.kt:87) ~[corda-core-4.5.jar:?]
    at net.corda.core.internal.TransactionUtilsKt$deserialiseComponentGroup.invoke(TransactionUtils.kt) ~[corda-core-4.5.jar:?]
    at net.corda.core.internal.LazyMappedList.get(InternalUtils.kt:597) ~[corda-core-4.5.jar:?]
    at java.util.AbstractList$Itr.next(AbstractList.java:358) ~[?:1.8.0_201]
    at java.util.AbstractCollection.toArray(AbstractCollection.java:141) ~[?:1.8.0_201]
    at java.util.ArrayList.addAll(ArrayList.java:581) ~[?:1.8.0_201]

您有一个 java.lang.ClassNotFoundException: com.example.flows.dataClass.BNOMetadata 错误,这意味着 运行 您的流程的节点在其 class 路径上没有那个 class,那可以是通过以下两种方式之一解决:

  1. 如果缺少的class是状态、合同或流程;您需要在节点上安装包含 class 的 CorDapp,这意味着您需要将该 CorDapp 的 jar 文件放在节点的 cordapps 文件夹中。
  2. 如果缺少的 class 不是 CorDapp 的一部分(例如,您创建的某些实用程序 class);您可以修改节点的 node.conf 并添加一个 jarDirs 条目(请参阅文档 here)。您可以在节点内创建一个文件夹(称之为 libs),然后设置 jarDirs = [ ${baseDirectory}"/libs" ] 并将包含 class 的 jar 文件放入其中。当节点启动时,它会将在 jarDirs 目录中找到的任何 class 添加到其 class 路径。

自定义元数据,即元数据class应该属于我们Cordapp的contracts模块