geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <>
Subject Re: EAR can't find WEB-INF/classes or WEB-INF/lib
Date Tue, 27 May 2008 06:03:10 GMT

On May 26, 2008, at 6:28 PM, Andrew Thorburn wrote:

> Ok, it now works. Well, kinda.
> I think I must have originally also had a lib directory directly  
> inside the EAR, as well as in the WAR, which was what was confusing  
> Geronimo. Removed that, and my bean didn't start. Removed the (small  
> but important) bits of code that relied on that, and everything  
> works. Except it doesn't do logging anymore for my MDB. Works fine  
> everywhere else.
> Apologies for not having the faintest idea what my problem was, but  
> there we go. I now have a new problem, however: How do I reference  
> the stuff in the WAR from my MDB JAR? I'm sure I saw information on  
> this somewhere, but I closed it because I thought I had a different  
> problem :(. I can't duplicate the JARS, as I'm sure that'll cause a  
> vast multitude of problems. I really just want to be able to  
> reference them easily, so that I don't have to worry about this when  
> coding my application. In fact, it's going to be very necessary to  
> communicate between the WAR and the MDB for it to be of any use at  
> all (AJAX stuff communicating between browser and database via Java  
> app). Basically need the WAR to be processed first, and then have  
> the MDB JAR processed, so that I can then reference all the classes  
> in the WAR.
> Is this possible? If not, what's the best alternative? Can I chuck  
> my MDB into the WAR? I'd be very surprised if I could do that. And I  
> don't know if that would solve any of my issues anyway...
> The exact location of the classfiles doesn't matter, just so long as  
> it all works...
> Feh. This is starting to do my head in. Won't be posting again for  
> nearly 24 hours (I only work part-time).

I'm not sure I've understood clearly what problem you are having.   
Maybe if I explain the classloader structure your app has and what I  
think you need to do it will help.

For an ear based application with no javaee app clients, there is one  
"base" classloader that includes all the ejb jars, all the rars, and  
all the jars in the lib directory.

Then for each war inside the ear, there is a separate classloader that  
is a child of the ear classloader that contains the jars in WEB-INF/ 
lib and the classes in WEB-INF/classes.  Since this is a child of the  
ear classloader, all the code in the war can see the classes in the  
ear (ejb, connector, and lib).  Also, since these war classloaders   
are  children of the ear, nothing in an ejb, connector or lib jar can  
see anything in any war classloader.

I think what you need to do is put any classes that need to be  
accessible to both the ejb app (such as your mdb) and the war(s) in  
either the ejb jar or in a jar in the ear's lib directory.  Putting  
any such class anywhere in any war file will definitely prevent it  
being accessible from the ejb application.

Hope this relates to what you are asking about :-)
david jencks
> Anyway, thanks again,
> - Andrew

View raw message