You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Jan Mauersberger <ja...@ikv.de> on 2000/08/28 11:40:55 UTC
Question about classloading
Hello,
I think this one is not a real servlet problem, but it brought up the
question. I tried to contact an EJB server from within a servlet (I used the
standard Converter example of the J2EE distribution). If the servlet is
loaded from the CLASSPATH, everything is okay. If it is not and the servlet
has its own classloader a "ClassCastException" is thrown when calling
"PortableRemoteObject.narrow" to get the home interface. I figured out, that
the returned object is the downloaded stub of the home interface and has its
own classloader, so the two versions of the interface are not compatible
because the local one was loaded by the servlet classloader. I made some
additional tests and found out that if I load a class via two different
classloaders (even from the same codebase) they are ALWAYS not compatible.
On the one hand I think this is a base feature of classloading but on the
other hand it prevents me from using multiple technologies together. We have
developed an mobile agent system and each mobile agent has its own
classloader too. So I have three technologies and nearly no chance to use
them without workarounds that will harm the functionality :(
So my question is: is this either a known problem or did nobody cared about
it or am I completely wrong? :)
Regards, Jan
--
Jan Mauersberger (mauersberger@ikv.de)
IKV++ GmbH
Bernburger Straße 24 - 25, 10963 Berlin
phone: +49-30-348 07 732 fax: +49-30-348 07 80