hazelcast / hazelcast-tomcat-sessionmanager

Tomcat Based Web Session Replication
Other
33 stars 37 forks source link

Problem with DateTimeFormatter not serializable #135

Open joaomoraski opened 11 months ago

joaomoraski commented 11 months ago

I am trying to implement Hazelcast for session replication in version 5.3.2 on Tomcat.

When I run my system, at the time of retrieving the session, it returns an error saying that it was not possible to serialize the DateTimeFormatter. I tried changing the class variable to a function or something similar in various places, but nothing had any effect.

After researching a bit, I found out that DateTimeFormatter is not serializable by Java's own decision. So, I would like to know if anyone has had a similar issue or if there is a known solution to address this problem.

Caused by: java.io.NotSerializableException: java.time.format.DateTimeFormatter
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
    at java.util.HashMap.internalWriteEntries(HashMap.java:1817)
    at java.util.HashMap.writeObject(HashMap.java:1364)
    at sun.reflect.GeneratedMethodAccessor264.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)