I've noticed a couple of threads about strange ClassCastException
problems ("Call EJB in OC4J from Tomcat", 
"pulling my hair out re: EJB in tomcat").

I've run into a strange ClassCastException in a slightly different
context, but it seems that it might be related and might help
narrow down the problem.

I have an application that is broken into two tomcat web-apps 
(contexts) ("MainApp", "HelperApp").

One thing I am trying to do is have the MainApp populate a 
request with some beans and then include a jsp from HelperApp:

   populateRequestWithBeans(); // uses RequestDispatcher.include()
   sc.getRequestDispatcher(TargetPage).include(request, response);

If the TargetPage is in MainApp this works fine.

If the TargetPage is in HelperApp and I run it from my development
environment (Tomcat 3.2.1) it runs fine (gets context of HelperApp).

If the TargetPage is in HelperApp and I run it in Tomcat 4.0 then
I get a ClassCastException in TargetPage on the line where the
TargetPage jsp tries to retrieve the bean (2nd line below):

   com.athensgroup.autoweb_projects.ClientInfo ClientInfo = null;
   ...
   ClientInfo= (com.athensgroup.autoweb_projects.ClientInfo)
     pageContext.getAttribute("ClientInfo",PageContext.REQUEST_SCOPE);

The runtime error complains that the object is actually of type
com.athensgroup.autoweb_projects.ClientInfo
which is clearly the SAME (textually)!

Since this works in some environments it eliminates issues of typos,
logic errors, etc in the code.

The key seems to be that the two web-apps think that the same class
is a different class!  (Both have copies of the SAME class file in their 
WEB-INF\classes directories.  

Is there something in Tomcat or the JVM which would make two 
different web-apps think that the same class is not the same class?
Obviously there is something MORE than just the class name that
is being used to distinguish them.

Frank Lawlor
Athens Group, Inc.
(512) 345-0600 x151
Athens Group, an employee-owned consulting firm integrating technology
strategy and software solutions.




--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to