Hi!

Aaron Mulder wrote:
>         Well, here's what I found.  The problem was a
> ClassNotFoundException.  When you serialize stuff to the DB, we read it
> back in using an ObjectInputStream (no surprise).  Apparently,
> ObjectInputStream calculates the ClassLoader to use by examining all the
> ClassLoaders for all the code in the stack.  Of course, all the code in
> the stack of the JAWS implementation is jBoss code, loaded by the system
> ClassLoader, so the ObjectInputStream tries to find your EJB helper
> classes using the system ClassLoader, which of course fails (every EJB JAR
> has its own ClassLoader).
>         So, I put in a "WorkaroundInputStream" that overrides
> "resolveClass" from ObjectInputStream to check the ContextClassLoader of
> the current thread first, and voila!  It works again.  The code is checked
> into CVS - give it a spin.
>         Rickard and others, is there a better way to load EJB classes, or
> an existing ObjectInputStream impl with the proper overrides?  I couldn't
> find one, but then I didn't look too hard either.

This is exactly the right way to do it. Actually I thought that there
was an "ObjectInputStreamWithClassLoader" somewhere (or was that EJBoss
1.0?) that did this...

Rename it to something more elegant ;-), and that should be ok.

Good work!

regards,
  Rickard

-- 
Rickard �berg

Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to