Hi all,

I'm posting on Struts list because I know they're is lot's of J2EE experts here.

I want to test my webapp on Tomcat, but it depends on some external system. I've got a 
jar that emulates it. When I
package it with the webapp (WEB-INF/lib) it works fine.

I would like to test the webapp packaged without this emulator jar. I tried putting it 
in $TOMCAT/common/lib. I get a
ClassCastException. I think it comes from this :

webapp requires the external API, let's say a class named "ExternalSystem". It is 
configured to search for an
implementation class named "ExternalSystemMockImpl" (using reflexion API).

Webapp classloader doesn't find it, and delegate class searh to it's parent 
classloader (tomcat ones). Parent
classloader finds the class from my emulator jar, run it and return some "MockResult" 
object, that implements
"ExternalResult" from the external API

Calling webapp tries to cast resulting object to "ExternalResult", class that is 
visible to webapp classloader.

Then my code is doing :

ExternalResult result = (ExternalResult) obj;

where obj is my MockResult instance, that implements ExternalResult from 
parent-Classloader, and casting it to a
webapp-Classloader ExternalResult fails !


How can I solve this ClasLoader conflict ?

Nico.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to