微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决在BNMS中添加自定义元数据会导致计数器流错误

在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,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,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,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,entityType: Session),actor=null,externalTrace=null,impersonatedActor=null),ourIdentity=O=BNO,sessions={SessionId(toLong=-5496602332043580286)=Initiated(peerParty=O=PartyA,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,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,948Z [Node thread-1] statemachine.StaffedFlowHospital. - Error 1 of 1: {fiber-id=10000001,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.BNOMetadata错误,这意味着运行流的节点的类路径上没有该类,可以通过以下两种方法之一来解决该问题:

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

自定义元数据(即元数据类)应属于Cordapp的合同模块

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。