Unable to deserialize object of type: java.util.concurrent.ConcurrentHashMap

549 views
Skip to first unread message

Preeti

unread,
Nov 20, 2012, 7:35:44 AM11/20/12
to memcached-se...@googlegroups.com

Hello,

   I am getting below exception. Can anyone help me in this..

WARNING: Could not load session with id 7A344970D8FA918FF097EF1292514E99-n1 from memcached.
com.esotericsoftware.kryo.SerializationException: Unable to deserialize object of type: java.util.concurrent.ConcurrentHashMap
        at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:593)
        at com.esotericsoftware.kryo.ObjectBuffer.readObject(ObjectBuffer.java:213)
        at de.javakaffee.web.msm.serializer.kryo.KryoTranscoder.deserializeAttributes(KryoTranscoder.java:256)
        at de.javakaffee.web.msm.TranscoderService.deserializeAttributes(TranscoderService.java:159)
        at de.javakaffee.web.msm.TranscoderService.deserialize(TranscoderService.java:116)
        at de.javakaffee.web.msm.MemcachedSessionService.loadFromMemcached(MemcachedSessionService.java:1017)
        at de.javakaffee.web.msm.MemcachedSessionService.findSession(MemcachedSessionService.java:568)
        at de.javakaffee.web.msm.MemcachedBackupSessionManager.findSession(MemcachedBackupSessionManager.java:228)
        at org.apache.catalina.connector.Request.doGetSession(Request.java:2419)
        at org.apache.catalina.connector.Request.getSession(Request.java:2157)
        at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
        at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:157)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at de.javakaffee.web.msm.SessionTrackerValve.invoke(SessionTrackerValve.java:126)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:679)
Caused by: com.esotericsoftware.kryo.SerializationException: Unable to deserialize object of type: org.apache.catalina.filters.CsrfPreventionFilter$LruCache
        at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:571)
        at com.esotericsoftware.kryo.serialize.MapSerializer.readObjectData(MapSerializer.java:129)
        at com.esotericsoftware.kryo.Serializer.readObject(Serializer.java:61)
        at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:589)
        ... 25 more
Caused by: com.esotericsoftware.kryo.SerializationException: Serialization trace:
cache (org.apache.catalina.filters.CsrfPreventionFilter$LruCache)
        at com.esotericsoftware.kryo.serialize.FieldSerializer.readObjectData(FieldSerializer.java:238)
        at com.esotericsoftware.kryo.serialize.ReferenceFieldSerializer.readObjectData(ReferenceFieldSerializer.java:81)
        at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:566)
        ... 28 more
Caused by: java.lang.NullPointerException
        at java.util.HashMap.put(HashMap.java:390)
        at com.esotericsoftware.kryo.serialize.MapSerializer.readObjectData(MapSerializer.java:130)
        at com.esotericsoftware.kryo.serialize.FieldSerializer.readObjectData(FieldSerializer.java:220)
        ... 30 more

Martin Grotzke

unread,
Nov 20, 2012, 9:56:13 AM11/20/12
to memcached-se...@googlegroups.com
It seems as if the implementation of the CsrfPreventionFilter.LruCache
is the issue, particularly the cache field (anonymous inner class).

You could try to write a custom kryo serializer for this class, but I
doubt that it's possible to recreate/deserialize an LruCache instance
with the same properties/the same behaviour (as the cacheSize will not
be accessible).

Alternatively you could try to use java serialization and see if this works.

Of course you might also switch off the CsrfPreventionFilter, not sure
if this is an option.

Cheers,
Martin
--
inoio gmbh - http://inoio.de
Breitenfelder Str. 13c, 20251 Hamburg
Amtsgericht Hamburg, HRB 123031
Geschäftsführer: Dennis Brakhane, Martin Grotzke, Ole Langbehn

signature.asc

Pawan Goyal

unread,
Sep 25, 2015, 3:01:28 AM9/25/15
to memcached-session-manager
I am also getting the same exception .I have changed the SerializationStrategies. to  de.javakaffee.web.msm.JavaSerializationTranscoderFactory.

Now its working fine.

Martin Grotzke

unread,
Sep 25, 2015, 3:20:50 AM9/25/15
to memcached-se...@googlegroups.com
Good to know. If you're interested (or anyone else) in having kryo
support this please submit an issue or pull request.

Cheers,
Martin


On 09/25/2015 08:48 AM, Pawan Goyal wrote:
> I am also getting the same exception .I have changed
> the SerializationStrategies
> <https://code.google.com/p/memcached-session-manager/wiki/SerializationStrategies>.
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "memcached-session-manager" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to memcached-session-...@googlegroups.com
> <mailto:memcached-session-...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

--
inoio gmbh - http://inoio.de
Schulterblatt 36, 20357 Hamburg
signature.asc
Reply all
Reply to author
Forward
0 new messages