corda / bootcamp-cordapp

Other
84 stars 128 forks source link

bootcamp.TokenState is not a net.corda.core.contracts.ContractState #22

Closed naman1303 closed 4 years ago

naman1303 commented 4 years ago

I am using JDK 1.8 version and following all the README.md steps. On running the nodes, pop up windows come for Notary, PartyA, PartyB and PartyC properly.

Terminal for PartyA - trying to issue the amount to PartyC

Fri Jun 12 11:13:47 IST 2020>>> start TokenIssueFlowInitiator owner: PartyC, amount: 1000
Starting

Terminal for PartyC - trying to check the vault of PartyC

Fri Jun 12 11:16:17 IST 2020>>> run vaultQuery contractStateType: bootcamp.TokenState
RPC failed: net.corda.core.CordaRuntimeException: java.lang.IllegalArgumentException: bootcamp.TokenState is not a net.corda.core.contracts.ContractState

This error is actually coming for all the nodes.

TokenState.java - This file has TokenState implementing ContractState

@BelongsToContract(TokenContract.class)
public class TokenState implements ContractState {
    private final Party issuer;
    private final Party owner;
    private final int amount;
    private final List<AbstractParty> participants;

    public TokenState(Party issuer, Party owner, int amount){
        this.issuer = issuer;
        this.owner = owner;
        this.amount = amount;
        this.participants = new ArrayList<>();
        participants.add(issuer);
        participants.add(owner);
    }

    @NotNull
    @Override
    public List<AbstractParty> getParticipants() {
        return Arrays.asList(issuer, owner);
    }

    public Party getIssuer() {
        return issuer;
    }

    public Party getOwner() {
        return owner;
    }

    public int getAmount() {
        return amount;
    }
}

What could be the issue here?

naman1303 commented 4 years ago

The issue is gone now. No code change. I just removed the build folder and deployed nodes again, rerunning the project. Issue was resolved afterwards.