有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java[R3 Corda]找不到com的合同附件。样板IOUContractnull

当我运行教程时:Hello, World!

Pt。2-合同约束有错误:

Cannot find contract attachments for com.template.IOUContractnull.

我从模板开始,然后完成helloword1。你好,我跑得很好

...build\nodes\PartyA\logs\node-clay-PC.log


--- Transition of flow [3d6b6d20-bc45-4e71-831a-b0cddd89b50d] ---
  Timestamp: 2019-07-02T11:57:54.562Z
  Event: Error(exception=net.corda.core.transactions.MissingContractAttachments: Cannot find contract attachments for com.template.IOUContractnull. See https://docs.corda.net/api-contract-constraints.html#debugging)
  Actions: 
    RollbackTransaction
    ScheduleEvent(event=DoRemainingWork)
  Continuation: ProcessEvents
  Diff between previous and next state:
checkpoint.errorState: 
    Clean
    Errored(errors=[FlowError(errorId=-9033011467502490789, exception=net.corda.core.transactions.MissingContractAttachments: Cannot find contract attachments for com.template.IOUContractnull. See https://docs.corda.net/api-contract-constraints.html#debugging)], propagatedIndex=0, propagating=false)
isFlowResumed: 
    true
    false

共 (3) 个答案

  1. # 1 楼答案

    您可能需要将其更改为:

    public class IOUContract implements Contract {
        public static final String ID = "com.template.contracts.IOUContract";
    

    我在Kotlin中完成了教程,并发现以下内容也适用于设置合同ID:

    companion object {
        val ID = IOUContract::class.qualifiedName!!
    }
    
  2. # 2 楼答案

    在我的例子中,我没有在我的契约类签名中添加implements Contract(它实现了一个extends Contract的接口)。我刚加了个符号,效果很好

  3. # 3 楼答案

    请参阅以下文档的“调试”部分- https://docs.corda.net/api-contract-constraints.html

    文件-

    If an attachment constraint cannot be resolved, a MissingContractAttachments exception is thrown. There are three common sources of MissingContractAttachments exceptions:

    1. You are running a test and have not specified the CorDapp packages to scan.
    2. When running the Corda node ensure all CordDapp JARs are placed in cordapps directory of each node
    3. You are specifying the fully-qualified name of the contract incorrectly

    在日志中,合同名称记录为“com.template.IOUContractnull”而不是“com.template.IOUContract

    Event: Error(exception=net.corda.core.transactions.MissingContractAttachments: Cannot find contract attachments for com.template.IOUContractnull. See https://docs.corda.net/api-contract-constraints.html#debugging)
    

    请检查IOUContract类中的ID值

    public class IOUContract implements Contract {
        public static final String ID = "com.template.IOUContract";