Blockchain 在BNMS中添加自定义元数据会导致计数器流错误

Blockchain 在BNMS中添加自定义元数据会导致计数器流错误,blockchain,corda,Blockchain,Corda,在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

在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$1.invoke(TransactionUtils.kt:87) ~[corda-core-4.5.jar:?]
    at net.corda.core.internal.TransactionUtilsKt$deserialiseComponentGroup$1.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.bNMetadata
错误,这意味着运行流的节点在其类路径上没有该类,可以通过以下两种方法之一解决:

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

  • 自定义元数据(即元数据类)应属于我们Cordapp的contracts模块

    始终提供问题中的错误日志条目。谢谢!!我的数据类放在workflows文件夹中。这样就不会在cordapp jar中了?是的,您必须将workflows cordapp的jar文件放在节点的
    cordapps
    文件夹中,然后重新启动节点;重新启动节点后,flow hospital将尝试从最后一个检查点重放您的流;因此,我建议您转到该jar文件并打开它(双击它),并探索导致丢失类的路径,以确保
    bNMetadata
    类是否存在于该jar文件中。谢谢!!我已验证。
    .class
    文件是为
    bNMetadata
    生成的。我想知道在该类中添加
    @cordaseriable
    注释是否可以解决问题,您能试试吗?添加注释,重建模块,将新jar文件放入
    cordapps
    文件夹,重新启动节点,检查日志文件是否仍在生成相同的错误消息。