[R3 Corda]找不到com.template.IOUContractnull的合同附件

时间:2019-07-02 13:35:00

标签: java corda

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

Pt.2-合同约束我有错误:

  

找不到com.template.IOUContractnull的合同附件。

我从模板开始,然后完成helloword1。 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

4 个答案:

答案 0 :(得分:2)

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

文档-

  

如果无法解决附件约束,则抛出MissingContractAttachments异常。缺少MissingContractAttachments异常的三种常见原因:

     
      
  1. 您正在运行测试,但未指定要扫描的CorDapp软件包。
  2.   
  3. 运行Corda节点时,请确保将所有CordDapp JAR放置在每个节点的cordapps目录中
  4.   
  5. 您未正确指定合同的全名
  6.   

在日志中,合同名称记录为“ 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";

答案 1 :(得分:0)

您正在运行哪个示例Cordapp?

您完成了此页面@ https://docs.corda.net/tutorial-cordapp.html上的内容吗?

答案 2 :(得分:0)

您可能需要将其更改为:

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

我在Kotlin中完成了该教程,发现以下设置合同ID的效果也很好:

companion object {
    val ID = IOUContract::class.qualifiedName!!
}

答案 3 :(得分:0)

就我而言,我没有在合约类签名中添加 implements Contract(它实现了一个 extends Contract 接口)。我刚刚添加了签名,效果很好。