Serializable class throwing class cast exception.

All,

I have a serializable class name 'Owner' and while login to the application, i put the object of this class in the session. Later in my application, when i am trying to retrieve this obejct from the session using the following code, throwing class cast exception.

Owner owner =(Owner)request.getSession().getAttribute(WebKeys.LOGGEDINOWNER_OWNER_KEY)

This piece of code works fine in test enviornment(single server), but fails in production which is clustered enviornment.

Any help will be appreciated

[539 byte] By [JosephCTSa] at [2007-11-26 17:06:57]
# 1
You either have problems with different classloaders, or that you should use javax.rmi.PortableObject.narrow instead of just a simple cast.Kaj
kajbja at 2007-7-8 23:34:44 > top of Java-index,Java Essentials,Java Programming...
# 2
What could be the problem with class loader ? How can i confirm that ? What is the solution ?
JosephCTSa at 2007-7-8 23:34:44 > top of Java-index,Java Essentials,Java Programming...
# 3

> What could be the problem with class loader ? How can

> i confirm that ? What is the solution ?

Change it into:

Object owner = request.getSession().getAttribute(WebKeys.LOGGEDINOWNER_OWNER_KEY);

System.out.println(owner.getClass() + " : " + Owner.class);

And see what it prints..

kajbja at 2007-7-8 23:34:45 > top of Java-index,Java Essentials,Java Programming...