Corda serialization throws exception validating java.time classes
See original GitHub issueCorda 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:
-
Clone modified version of official Corda example from [GitHub] https://github.com/kaushikb92/samples.git
-
Checkout to branch bug/zonedDateTime. I’ve edited in cordapps-example/contracts-kotlin/IOUSchema.kt and cordapps-example/contracts-kotlin/IOUState.
-
Build, deploy nodes and start the nodes. Follow https://docs.corda.net/tutorial-cordapp.html for instructions.
-
Create a new IOU from party A
flow start ExampleFlow$Initiator iouValue: 50, otherParty: "O=PartyB,L=New York,C=US"
- 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:
- Created 4 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The title should probably read “Corda serialization throws exception validating java.time classes” - it applies to
LocalDateTime
too for sure.https://r3-cev.atlassian.net/browse/CORDA-3152