jackson-modules-java8
jackson-modules-java8 copied to clipboard
Unable to serialize JavaTimeModule object (in 2.x)
Hi,
The JavaTimeModule
class registers bunch of deserializers that extends JSR310DateTimeDeserializerBase
. This class implements java.io.Serializable
interface but at the same time it has a reference to java.time.format.DateTimeFormatter
object which is not serializable.
Looking at the implemented interfaces (of both classes: JavaTimeModule
and JSR310DateTimeDeserializerBase
) I would expect not to see NotSerializableException
during serialization.
regards
Ok thank you for reporting this -- I will move the issue under correct repo and see if I can reproduce actual issue.
FWTW, Jackson 3.0 can serialize these fine, but with 2.x (including 2.10), only other 2 modules (java8 datatypes; parameter names) are serializable. Problem is java.time.format.DateTimeFormatter
which is not serializable and that we rely on.
Quick note: this is not something we can fix at all for Jackson 2.x. But is fixed for 3.0 (master
), so closing.