We get a ClassCastException when we try to cast an object received as a
parameter to an EJB method.

The problem happends under these circumstances:
Both EJB´s (client and server) are Session Stateless using BMP (bean
managed persistence).
The class of the object qe try to cast to, is definded in one of the EJB
proyects, and it's jar is included as a library in the other EJB´s ear
We tried using WebSphere 5.0 and WebSphere 5.1 and in both cases we got the
very same error.
Both EJB´s are running in the same server but deployed using different
We observed that the classloader reported is different for the class of the
parameter and for the class we are trying to cast to.

We made some test that did work properly:
Deploying both EJBs using the same EAR.
Installing the parameter class in the /lib
Modifying the code generated form stubs and forcing the calls to be seen as
remote calls.
Calling de method from a class deployed in a War.

Thanks in advance.