question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Corda serialization throws exception validating java.time classes

See original GitHub issue

Corda version used: 4.1-RC03

Issue: Using of ZonedDateTime in contract schema and states throws exception in vaultQuery from node console.

RPC failed: com.fasterxml.jackson.databind.JsonMappingException: Unexpected IOException (of type net.corda.serialization.internal.amqp.AMQPNotSerializableException): Defined getter for parameter month returns type class java.time.Month yet underlying type is short

Steps to reproduce:

  1. Clone modified version of official Corda example from [GitHub] https://github.com/kaushikb92/samples.git

  2. Checkout to branch bug/zonedDateTime. I’ve edited in cordapps-example/contracts-kotlin/IOUSchema.kt and cordapps-example/contracts-kotlin/IOUState.

  3. Build, deploy nodes and start the nodes. Follow https://docs.corda.net/tutorial-cordapp.html for instructions.

  4. Create a new IOU from party A

flow start ExampleFlow$Initiator iouValue: 50, otherParty: "O=PartyB,L=New York,C=US"
  1. Query on the vault.
run vaultQuery contractStateType: com.example.state.IOUState

You should get the exception.

Note: Same was working in Corda 4.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
manosbatsiscommented, Jul 27, 2019

The title should probably read “Corda serialization throws exception validating java.time classes” - it applies to LocalDateTime too for sure.

Read more comments on GitHub >

github_iconTop Results From Across the Web

In Corda, NotSerializableException when running a validating ...
This is due to the fact that the validating notary hasn't installed all of the CorDapps involved in the transaction it is validating....
Read more >
Object serialization - R3 Documentation
In classic Java serialization, any class on the JVM classpath can be deserialized. ... All Corda exceptions that are expected to be serialized...
Read more >
Serialization Validation in Java - Baeldung
Learn about validating serializable objects in Java. ... Such code will throw a ClassCastException at runtime:
Read more >
Building, deploying, and running a Corda 5 CorDapp
The CorDapp will be developed in Kotlin targetting Java 11. Corda API requires us to use Java 11. We will use the Gradle...
Read more >
Java Object Serialization Specification: 3 - Object Input Classes
It is only correct to register validations during a call to a class's readObject method. Otherwise, a NotActiveException is thrown. If the callback...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found