Clay Lu
Clay Lu

Reputation: 31

[R3 Corda]Cannot find contract attachments for com.template.IOUContractnull

When I run tutorial: Hello, World!

Pt.2 - Contract constraints I hava the error:

Cannot find contract attachments for com.template.IOUContractnull.

I start from template and then finish helloword1. helloword1 run OK.

...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

Upvotes: 2

Views: 1041

Answers (3)

McXD
McXD

Reputation: 35

In my case, I didn't add implements Contract in my contract class signature (which implements an interface that extends Contract). I just added the siginature and it worked fine.

Upvotes: 0

JacDek
JacDek

Reputation: 73

You might need to change it to:

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

I completed the tutorial in Kotlin and found that the following worked as well for setting the contract ID:

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

Upvotes: 2

devman
devman

Reputation: 504

Please refer "Debugging" section of following documentation - https://docs.corda.net/api-contract-constraints.html

Docs -

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

In the logs the contract name is recorded as "com.template.IOUContractnull" instead of "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)

Please check ID value in IOUContract class.

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

Upvotes: 3

Related Questions