0
votes

I am having this error when I am calling my custom flow through my RPCClient.

@PostMapping(value="/flows/issue")
private fun issuance(@RequestBody note : Money){
    val matchingParties = proxy.partiesFromName(note.owner, false)
    if(matchingParties.size != 1)
        throw IllegalArgumentException("Enter a valid Party name")
    val recipient = matchingParties.single()
    proxy.startFlow(::IssueMoney, note.currency, note.amount, recipient)
}

My custom flow is another class with the classpath net.corda.server.flows . I have annotated it as @CordaSerializable and added the "-parameters" in the java compiler.

The error at the console at my node was

Serialization failed direction="Deserialize", type="java.lang.Class", msg="Could not instantiate net.corda.server.flows.IssueMoney - not on the classpath", corda ClassChain="java.util.List<*> -> net.corda.server.flows.IssueMoney"

The error at my webserver was

java.io.NotSerializableException: net.corda.server.flows.IssueMoney was not found by the node, check the Node containing the CorDapp that implements net.corda.server.flows.IssueMoney is loaded and on the Classpath

1

1 Answers

0
votes
  1. CordaSerializable is an annotation that you put on a class that gets sent/received by your flow; for instance you have some custom class MyClass that your initiator sends to the responder; you mark MyClass with @CordaSerializable; this way when your initiator calls send, it gets checkpointed (i.e. all its data is written to disk), part of that data is your MyClass which with that annotation allows Corda to serialize it (when flow is checkpointed) and deserialize (when the flows resumes). So in summary, remove the annotation from the flow.
  2. I assume that the error happened because somewhere in your flow you're using java.util.List (that's what shows in your error message); List is an interface, so Corda won't know how to serialize/deserialize it, instead you have to use an implementation of the List interface like ArrayList or LinkedList.