POJO variables with OffsetDateTime

I am attempting to pass as a variable a POJO with properties of type OffsetDateTime. Zeebe throws the following exception when it encounters properties of this type as follows:

Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of java.time.OffsetDateTime (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
at [Source: (String)“{“item”:“headphones”,“price”:2000.0,“orderId”:216000000,“packages”:null,“shipment”:null,“timeStamp”:{“offset”:{“totalSeconds”:-18000,“id”:”-05:00",“rules”:{“transitions”:,“transitionRules”:,“fixedOffset”:true}},“hour”:16,“minute”:43,“second”:1,“nano”:216000000,“year”:2019,“month”:“SEPTEMBER”,“dayOfMonth”:18,“dayOfWeek”:“WEDNESDAY”,“dayOfYear”:261,“monthValue”:9},“numberOfItems”:2,“orderProcessed”:false}"; line: 1, column: 102] (through reference chain: com.sailpoint.rss.rss_service.model.OrderCommand[“timeStamp”])
at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67) ~[jackson-databind-2.9.9.3.jar:2.9.9.3]
at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1452) ~[jackson-databind-2.9.9.3.jar:2.9.9.3]
at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1028) ~[jackson-databind-2.9.9.3.jar:2.9.9.3]
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1297) ~[jackson-databind-2.9.9.3.jar:2.9.9.3]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:326) ~[jackson-databind-2.9.9.3.jar:2.9.9.3]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159) ~[jackson-databind-2.9.9.3.jar:2.9.9.3]

Any recommendations on how to proceed here? Read some of the Jackson documentation and tried to register some modules but wondering if you guys have run into this or what types you use for time.

Hi @klaus.nji,

I would recommend to serialize the date-time variables as long/string, or using a custom serialization and passing the variables as JSON string directly.

Does this help you?

Best regards,
Philipp

1 Like

I guess that will have to do. Was hoping you guys supported newer time constructs. Just out of curiosity, what time constructs do you use in Zeebe?

I agree that it would be nice to support this or have an option to extend/customize the POJO de-/serialization. I will keep this in mind. :wink:

In the protocol, date/time is stored as long value. Internally, in the broker we use also Java 8 date/time objects at some places.