geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark L." <>
Subject Re: Multiple Applications within one Ear - Co-dependent classes
Date Thu, 12 Oct 2006 12:51:06 GMT

Thanks for the response.  I am not sure i gave enough information the first
time as to what our problem truly is.  We are using a factory to instanciate
a list of classes.  This factory lives at the EAR level; the list of classes
are spread thru-out the multiple web modules.  This means that the factory
needs to instantiate some classes in WebA and some classes in WebB.  It
appears the way we have configured out application, the factory itself is
loaded in WebA's classloader (WebA is the first to load).  Because of this,
when the factory tries to instantiate classes in the list that reside in
WebB, they are not visible and we get the classNotFound exception.  I think
putting the classes into jars and adding them as dependencies might be
overkill since there is no real co-dependency upon the classes as i inferred
in my original post.  It is simply to be able to instantiate them.

Or is there a way to load our factory in the EAR at startup, which i assume
would have visibility to all classes in all web modules?  This would allow
all classes to be instantiated.  

We have another application running on Websphere where we have a similar
setup.  We use the same factory living at the EAR level, with multiple web
modules.  When the first module loads, it loads the factory, which is then
able to instantiate all classes listed, regardless of the modules they
reside in.

David Jencks wrote:
> On Oct 11, 2006, at 10:18 AM, Mark L. wrote:
>> Hello,
>> I am using Geronimo 1.1.1.  I have created an EAR,  
>> ApplicationIntgrations,
>> that contains two web modules, WebA and WebB.  Both web modules  
>> require
>> access to each others classes to be able to run.  WebA depends on  
>> classes in
>> WebB, and vice versa.  When i deploy the EAR and start the server,  
>> i get
>> classNotFound errors.  See below.  Class 'test' is a class in WebB,  
>> but
>> WebA's classloader cannot find him.
>> 1:08:49,334 ERROR [[/WebA]] Servlet /WebA threw load() exception
>> java.lang.ClassNotFoundException: test in classloader
>> Applications/ApplicationIntegrations_WebA.war/EAR/car
>> 	at
>> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass 
>> (
>> 	at java.lang.ClassLoader.loadClass(
>> How can i make both web modules' classes visible to each other?  I  
>> have
>> tried using dependencies and imports, but i am new to Gernoimo and  
>> have not
>> been able to get either to work.
> Since all the classes need to be in the same classloader, you won't  
> be able to use dependencies to make this work, as that would lead to  
> circular classloader dependencies.  You have to get the classes into  
> the ear's classloader: each web app classloader is a child of the ear  
> classloader.
> I can think of 3 solutions:
> 1. Put your classes in jars in appropriate places in the geronimo  
> repository and add dependencies to them to the geronimo application  
> plan.
> 2. Put the jars in the shared/lib directory and add a dependency to  
> the shared lib configuration either in the  geronimo application plan  
> or in each web app geronimo plan
> 3. Include a fake ejb jar (i.e. a jar with an ejb deployment  
> descriptor but no ejbs declared) that either contains all the classes  
> or uses the manifest classpath to include the jars with the classes.
> If you only need a one-way dependency then it would be much easier,  
> you could just have one web app depend on the other.
> thanks
> david jencks

View this message in context:
Sent from the Apache Geronimo - Users mailing list archive at

View raw message