Title: ClassCastException from serialize, redploy, deserialize
I upgraded to 3.0.0 release and I'm still getting the
ClassCastException after hot redeploy.
 
Filed as bug 563120
 
 
When CMP deserializes an Object from a persistent field
mapped to BLOB what ClassLoader is used.  Or is there
some Class ident stored when an object is serialized. The
JDK docs for ObjectInputStream seem to imply that maybe
the serial version id of the object affects which Class is
created to deserialize the object.
 
So when I do a hot redeploy in JBoss is the VM caching the
original Class object then I'm trying to cast to an interface
loaded from a different ClassLoader?
 
Should be possible to create a custom ObjectInputStream
to control which ClassLoader is used and how the Class
is resolved from the input stream.   A quick grep in the
JBoss source and it looks like JDBCUtil.convertByteArrayToObject()
is where the deserialization is done.  I could derive an
ObjectInputStream that used a JBoss class loader instead
of the "standard mechanisms".  Might that fix the problem?
Where would I get a reference to the right JBoss class loader?
 
JD
 
-----Original Message-----
From: Scott M Stark [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 31, 2002 12:41 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] ClassCastException from serialize, redploy, deserialize

The problem is probably the same one we saw when binding and then
rebinding ejb home proxies into JNDI using java.rmi.MarshalledObjects.
The issue is that there was some caching being done at the vm layer based
on identity of the class loader. Try your testcase with the new 3.0.0 release
which changed how class loaders computed equality and hashCode
and if there is still a problem open a bug.
 
xxxxxxxxxxxxxxxxxxxxxxxx
Scott Stark
Chief Technology Officer
JBoss Group, LLC
xxxxxxxxxxxxxxxxxxxxxxxx
----- Original Message -----
From: JD Brennan
Sent: Friday, May 31, 2002 12:06 PM
Subject: [JBoss-user] ClassCastException from serialize, redploy, deserialize

I've narrowed down my ClassCastException to
deserializing an Object after redeploying.

I serialize an Object to BLOB in MySQL using
CMP.  Then redeploy and when I deserialize the
object I can't cast the Object to one of it's
interfaces.

Could this be some ClassLoader issue?  The
interface is loaded by a JBoss class loader
and the deserialized object is loaded by
another ClassLoader.

I think I've got a good handle on the problem,
but can't think of a good solution - aside from
not using hot deploy...

Tx for any thoughts!
JD

Reply via email to