tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Speed <psp...@progeeks.com>
Subject Re: servlets in tomcat - EJBs in WebLogic 5.1
Date Thu, 28 Sep 2000 01:32:31 GMT
Hello,

	I'm not going to be of much help... I know why it happens
but I don't know how to fix it yet.  We have the exact same problem
and I would be glad to hear if you find a solution.  Since it works
with things being in CLASSPATH it got pushed to the back burner.

	One thing you might try is removing the EJB classes, like the
home interface, from the jar file that you put in WEB-INF/lib.  This
_should_ cause the classes to be loaded over the connection to 
Weblogic and should eliminate your class casting problems... but I have
not tried it and it is a much less than ideal solution.

	What happens is that the classloader that's used when 
marshalling objects from Weblogic to Tomcat is a sibling to the 
classloader that your servlets/jsps use.  So class Foo loaded in one
is not cast-compatable with class Foo loaded in the other.  Since 
classloaders generally defer loading to their parent classloader,
then when you put class Foo in your system classpath then the class
is only loaded once.

	The solution is to somehow get Weblogic's classloader to use
the servlet/jsp classloader as its parent.  The other day someone
suggested setting the Thread's classloader context.  I'm not sure if
this will work with Weblogic... but it sounds like the right idea.

	Good luck and let me know if you get it working!
	-Paul

matthew denner wrote:
> 
> Dear all,
> 
> i wanted to drop everyone a mail to point out a problem that i've had with
> tomcat and weblogic 5.1 interacting just to see if anyone has experienced a
> similar problem and whether there is a better solution.
> 
> i have some session EJBs deployed in weblogic 5.1; a servlet running under
> tomcat creates one these EJBs and then uses it (i know the architecture isn't
> great but i'm attempting to migrate slowly).  the problem is that i get a
> ClassCastException thrown when i try to narrow the EJB Home interface
> retrieved from the initial context.
> 
> the problem can be solved by NOT putting the EJB jar file in the WEB-INF/lib
> directory for the servlet, but rather to add it to the CLASSPATH used by
> tomcat on startup.  i'm assuming this has something to do with difference
> between the class loading mechanisms for tomcat and the servlets.  i do not
> want this nasty solution to be the only one; anyone recommend a better one?
> 
> to the developers of tomcat, is this a bug, feature, or something that has
> been overlooked?  can it be fixed?
> 
> Cheers,
> Matt
> 
> -----------------------------------------------------------------------------
> Sessami is a trademark of Escape Velocity Technology Mobile Services Limited.
> All information contained in this e-mail is confidential and for the use of
> the addressee only.  If you receive this message in error please notify.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

Mime
View raw message