views:

320

answers:

3

Has any one done it yet? I am having class loader problems de-serializing the grails session object.

Here is the error:

WARN net.spy.memcached.transcoders.SerializingTranscoder: Caught CNFE decoding 1168 bytes of data [exec] java.lang.ClassNotFoundException: com.myapp.User [exec] at org.codehaus.groovy.tools.RootLoader.findClass (RootLoader.java:156) [exec] at java.lang.ClassLoader.loadClass(ClassLoader.java:319) [exec] at org.codehaus.groovy.tools.RootLoader.loadClass (RootLoader.java:128) [exec] at org.codehaus.groovy.grails.cli.support.GrailsRootLoader.loadClass (GrailsRootLoader.java:43) [exec] at java.lang.ClassLoader.loadClass(ClassLoader.java:254) [exec] at java.lang.ClassLoader.loadClassInternal (ClassLoader.java:402) [exec] at java.lang.Class.forName0(Native Method) [exec] at java.lang.Class.forName(Class.java:247) [exec] at java.io.ObjectInputStream.resolveClass (ObjectInputStream.java:604) [exec] at java.io.ObjectInputStream.readNonProxyDesc (ObjectInputStream.java:1575) [exec] at java.io.ObjectInputStream.readClassDesc (ObjectInputStream.java:1496) [exec] at java.io.ObjectInputStream.readOrdinaryObject (ObjectInputStream.java:1732) [exec] at java.io.ObjectInputStream.readObject0 (ObjectInputStream.java:1329) [exec] at java.io.ObjectInputStream.readObject (ObjectInputStream.java:351) [exec] at net.spy.memcached.transcoders.BaseSerializingTranscoder.deserialize (BaseSerializingTranscoder.java:100) [exec] at net.spy.memcached.transcoders.SerializingTranscoder.decode (SerializingTranscoder.java:66)

+1  A: 

I guess there is no easy way to fix it since Grails is using a custom classloader to load the domain classes (I assume the com.myapp.User class is a domain class). As a workaround you could store just store the id of the user in the session and use a technique like I've described here to retrieve it on every request. This would also provide the benefit of reducing the size of the session that needs to be replicated.

Siegfried Puchbauer
I think its a good idea if it was the only Groovy object in session and could be recovered from second instance of Tomcat from persistent store. But mine is a complicated app and uses a mix of Groovy and Java ,and has all sorts of objects in session (which in itself is a problem
Langali
A: 

I've only ever used sticky sessions via an apache mod_proxy setup so have never tried sharing session data across nodes. Is that an option for you?

leebutts
I am already doing the loadbalancing, but I need to go a step further now.
Langali
A: 

en.I meet the same problem,Is it fixed now?

yishh.lee