title: Corda : java.lang.IllegalArgumentException: This AttachmentWithContext was not initialised properly
body: <p>We have a custom Implementation of Nonfungible token state and Nonfungible token contract in our project. We are using the below piece of code to issue our custom non fungible token.</p>
  <pre><code>        Party notary = NotaryUtilitiesKt.getPreferredNotary(getServiceHub(),NotaryUtilitiesKt.firstNotary());
          TransactionBuilder transactionBuilder = new TransactionBuilder(notary);
          IssueTokensUtilitiesKt.addIssueTokens(transactionBuilder, tokensToIssue);
          FlowUtilitiesKt.addTokenTypeJar(tokensToIssue, transactionBuilder);
  </code></pre>
  <p>when trying to convert the above obtained transaction builder to a wired transaction(<code> builder.toWireTransaction(serviceHub);</code>) we are getting an error with the below stack trace.</p>
  <pre><code>java.lang.IllegalArgumentException: This AttachmentWithContext was not initialised properly. Please ensure all Corda contracts extending existing Corda contracts also implement the Contract base class.
      at net.corda.core.internal.AttachmentWithContext.&lt;init&gt;(AttachmentWithContext.kt:18)
      at net.corda.core.transactions.TransactionBuilder.handleContract(TransactionBuilder.kt:487)
      at net.corda.core.transactions.TransactionBuilder.selectContractAttachmentsAndOutputStateConstraints(TransactionBuilder.kt:359)
      at net.corda.core.transactions.TransactionBuilder.toWireTransactionWithContext(TransactionBuilder.kt:159)
      at net.corda.core.transactions.TransactionBuilder.toWireTransactionWithContext$core(TransactionBuilder.kt:146)
      at net.corda.core.transactions.TransactionBuilder.toWireTransaction(TransactionBuilder.kt:140)
  </code></pre>