Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corda serialization throws exception validating java.time classes #5298

Closed
kaushikb92 opened this issue Jul 12, 2019 · 6 comments
Closed

Corda serialization throws exception validating java.time classes #5298

kaushikb92 opened this issue Jul 12, 2019 · 6 comments

Comments

@kaushikb92
Copy link

@kaushikb92 kaushikb92 commented Jul 12, 2019

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

@praveennagpal

This comment has been minimized.

Copy link

@praveennagpal praveennagpal commented Jul 22, 2019

Any update on this one as this issue is hitting us as well? Started getting this error Jackson mapping from vault state to json format post Corda 4.1 upgrade. It was working ok in Corda 3.3.

@manosbatsis

This comment has been minimized.

Copy link
Contributor

@manosbatsis manosbatsis commented Jul 24, 2019

Same here

[ERROR] 17:36:27,711 [http-nio-auto-1-exec-8] [/].[dispatcherServlet].log - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [errorCode=scf69f, moreInformationAt=https://errors.corda.net/OS/4.1/scf69f]
 net.corda.serialization.internal.amqp.AMQPNotSerializableException: Defined getter for parameter month returns type class java.time.Month yet underlying type is short
    at net.corda.serialization.internal.amqp.PropertyDescriptor.validate(PropertyDescriptor.kt:38) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.amqp.PropertyDescriptorKt$validated$1$1.accept(PropertyDescriptor.kt:252) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.amqp.PropertyDescriptorKt$validated$1$1.accept(PropertyDescriptor.kt) ~[corda-serialization-4.1.jar:?]
    at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[?:1.8.0_212]
    at net.corda.serialization.internal.amqp.PropertyDescriptorKt.validated(PropertyDescriptor.kt:252) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.amqp.PropertyDescriptorKt.propertyDescriptors(PropertyDescriptor.kt:100) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.getConstructorPairedProperties(LocalTypeInformationBuilder.kt:313) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.nonCalculatedProperties(LocalTypeInformationBuilder.kt:305) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildObjectProperties(LocalTypeInformationBuilder.kt:300) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildNonAtomic(LocalTypeInformationBuilder.kt:216) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildForClass(LocalTypeInformationBuilder.kt:128) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildIfNotFound(LocalTypeInformationBuilder.kt:90) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.access$buildIfNotFound(LocalTypeInformationBuilder.kt:36) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder$build$2.invoke(LocalTypeInformationBuilder.kt:69) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder$build$2.invoke(LocalTypeInformationBuilder.kt:36) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.ConfigurableLocalTypeModel$BuilderLookup.findOrBuild(LocalTypeModel.kt:73) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.build(LocalTypeInformationBuilder.kt:65) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.resolveAndBuild(LocalTypeInformationBuilder.kt:77) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildTypeParameterInformation(LocalTypeInformationBuilder.kt:382) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildForParameterised(LocalTypeInformationBuilder.kt:154) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildIfNotFound(LocalTypeInformationBuilder.kt:97) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.access$buildIfNotFound(LocalTypeInformationBuilder.kt:36) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder$build$2.invoke(LocalTypeInformationBuilder.kt:69) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder$build$2.invoke(LocalTypeInformationBuilder.kt:36) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.ConfigurableLocalTypeModel$BuilderLookup.findOrBuild(LocalTypeModel.kt:73) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.build(LocalTypeInformationBuilder.kt:65) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.resolveAndBuild(LocalTypeInformationBuilder.kt:77) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.access$resolveAndBuild(LocalTypeInformationBuilder.kt:36) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder$buildInterfaceInformation$1.invoke(LocalTypeInformationBuilder.kt:265) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder$buildInterfaceInformation$1.invoke(LocalTypeInformationBuilder.kt:36) ~[corda-serialization-4.1.jar:?]
    at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:149) ~[kotlin-stdlib-1.2.71.jar:1.2.71-release-64 (1.2.71)]
    at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:109) ~[kotlin-stdlib-1.2.71.jar:1.2.71-release-64 (1.2.71)]
    at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:133) ~[kotlin-stdlib-1.2.71.jar:1.2.71-release-64 (1.2.71)]
    at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:647) ~[kotlin-stdlib-1.2.71.jar:1.2.71-release-64 (1.2.71)]
    at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:677) ~[kotlin-stdlib-1.2.71.jar:1.2.71-release-64 (1.2.71)]
    at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:668) ~[kotlin-stdlib-1.2.71.jar:1.2.71-release-64 (1.2.71)]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildInterfaceInformation(LocalTypeInformationBuilder.kt:266) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildNonAtomic(LocalTypeInformationBuilder.kt:204) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildForClass(LocalTypeInformationBuilder.kt:128) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildIfNotFound(LocalTypeInformationBuilder.kt:90) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.access$buildIfNotFound(LocalTypeInformationBuilder.kt:36) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder$build$2.invoke(LocalTypeInformationBuilder.kt:69) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder$build$2.invoke(LocalTypeInformationBuilder.kt:36) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.ConfigurableLocalTypeModel$BuilderLookup.findOrBuild(LocalTypeModel.kt:73) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.build(LocalTypeInformationBuilder.kt:65) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.resolveAndBuild(LocalTypeInformationBuilder.kt:77) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildConstructorInformation(LocalTypeInformationBuilder.kt:395) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildNonAtomic(LocalTypeInformationBuilder.kt:215) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildForClass(LocalTypeInformationBuilder.kt:128) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.buildIfNotFound(LocalTypeInformationBuilder.kt:90) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.access$buildIfNotFound(LocalTypeInformationBuilder.kt:36) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder$build$2.invoke(LocalTypeInformationBuilder.kt:69) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder$build$2.invoke(LocalTypeInformationBuilder.kt:36) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.ConfigurableLocalTypeModel$BuilderLookup.findOrBuild(LocalTypeModel.kt:73) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformationBuilder.build(LocalTypeInformationBuilder.kt:65) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.LocalTypeInformation$Companion.forType(LocalTypeInformation.kt:62) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.model.ConfigurableLocalTypeModel.inspect(LocalTypeModel.kt:92) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.amqp.DefaultLocalSerializerFactory.getTypeInformation(LocalSerializerFactory.kt:102) ~[corda-serialization-4.1.jar:?]
    at net.corda.serialization.internal.amqp.ComposedSerializerFactory.getTypeInformation(SerializerFactory.kt) ~[corda-serialization-4.1.jar:?]
    at net.corda.client.jackson.internal.CordaSerializableBeanSerializerModifier.changeProperties(CordaModule.kt:101) ~[corda-jackson-4.1.jar:?]

@praveennagpal

This comment has been minimized.

Copy link

@praveennagpal praveennagpal commented Jul 24, 2019

The only workaround I got was to change the type of the field from LocalDateTime to a String type in my Java model.

@manosbatsis

This comment has been minimized.

Copy link
Contributor

@manosbatsis manosbatsis commented Jul 27, 2019

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

manosbatsis pushed a commit to manosbatsis/corbeans that referenced this issue Jul 27, 2019
…te from java.time.LocalDateTime to java.util.Date to work around corda/corda#5298
@kaushikb92 kaushikb92 changed the title Unable to query on stored ZonedDateTime: Defined getter for parameter month returns type class java.time.Month yet underlying type is short Corda serialization throws exception validating java.time classes Jul 29, 2019
@shamsasari

This comment has been minimized.

Copy link
Member

@shamsasari shamsasari commented Aug 20, 2019

@fowlerrr

This comment has been minimized.

Copy link
Contributor

@fowlerrr fowlerrr commented Oct 17, 2019

https://r3-cev.atlassian.net/browse/CORDA-3152 has been merged for Corda 4.3

@fowlerrr fowlerrr closed this Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.