You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Jochen Zink <jo...@web.de> on 2007/05/15 16:55:08 UTC

Classloader/Classpath Problems with Webapp and EJB-jar in same EAR.

Hello all,

I have an EAR Archive. The archive contains a WAR-File (WebApp.war) and a JAR File (ejb.jar). The JAR contains a MessageDrivenBean. In a lib folder inside the ear are some JAR-Libs. Some of these libs are used from the webapp and some from the MDB.

My Problem is:
Both, the war and the ejb jar Archive have a MANIFEST.MF in the META-INF Directory. In that manifest the class-path attribute is set to some libs in the lib folder inside the ear. This works fine if I does not place ejb.jar in the ear and the war archive is the only one inside the ear. But if both archives are inside the ear some strange errors happens. While deploying the Webapp, geronimo does not find the libs which are placed in lib folder of the ear (NoClassDefFound). Whithout the ejb.jar, the Webapplication is loaded correctly. If I define exactly the same class-path attribute in manifest.mf of the ejb-jar, the webapplication starts correctly. So, it seems that the ejb.jar manipulate the classpath of the webapplication. 

With two Webapplications inside the same ear, everythink works fine. The problem raised only with WAR nad EJB-Jar archives. 

Has anyone an idea why this happen?

Thanaks a lot!

structure:
ear:
|-- lib/
      |--jarFileA.jar
      |--jarFileB.jar
|-- META-INF/
      |--application.xml
      |--geronimo-application.xml
|-- WebApp.war
      |-- WEB-INF/
              |--- // Some webapp stuff
      |-- META-INF/
              |-- web.xml
              |-- geronimo-web.xml
              |-- MANIFEST.MF
|-- ejb.jar
      |-- META-INF
              |-- ejb-jar.xml
              |-- openejb-jar.xml
              |-- MANIFEST.MF

_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066


Re: Classloader/Classpath Problems with Webapp and EJB-jar in same EAR.

Posted by David Jencks <da...@yahoo.com>.
On May 15, 2007, at 7:55 AM, Jochen Zink wrote:

> Hello all,
>
> I have an EAR Archive. The archive contains a WAR-File (WebApp.war)  
> and a JAR File (ejb.jar). The JAR contains a MessageDrivenBean. In  
> a lib folder inside the ear are some JAR-Libs. Some of these libs  
> are used from the webapp and some from the MDB.
>
> My Problem is:
> Both, the war and the ejb jar Archive have a MANIFEST.MF in the  
> META-INF Directory. In that manifest the class-path attribute is  
> set to some libs in the lib folder inside the ear. This works fine  
> if I does not place ejb.jar in the ear and the war archive is the  
> only one inside the ear. But if both archives are inside the ear  
> some strange errors happens. While deploying the Webapp, geronimo  
> does not find the libs which are placed in lib folder of the ear  
> (NoClassDefFound). Whithout the ejb.jar, the Webapplication is  
> loaded correctly. If I define exactly the same class-path attribute  
> in manifest.mf of the ejb-jar, the webapplication starts correctly.  
> So, it seems that the ejb.jar manipulate the classpath of the  
> webapplication.
>
> With two Webapplications inside the same ear, everythink works  
> fine. The problem raised only with WAR nad EJB-Jar archives.
>
> Has anyone an idea why this happen?

Please always supply complete information on which version of  
geronimo you are using.  We occasionally have fixed bugs :-)

NoClassDefFound usually means the class is in an unexpected  
classloader, not that it isn't there at all.  What is the exact  
error?  Do any classes in the lib jars load classes from the war?

The ejb jars' classloader is going to be a parent of the war  
classloader, so if you remove the manifest classpath entries from the  
war that are also present in the ejb jars manifest classpath the lib  
classes should be available to both the ejbs and the web layer, both  
loaded in the same classloader.

Hope this helps
thanks
david jencks

>
> Thanaks a lot!
>
> structure:
> ear:
> |-- lib/
>       |--jarFileA.jar
>       |--jarFileB.jar
> |-- META-INF/
>       |--application.xml
>       |--geronimo-application.xml
> |-- WebApp.war
>       |-- WEB-INF/
>               |--- // Some webapp stuff
>       |-- META-INF/
>               |-- web.xml
>               |-- geronimo-web.xml
>               |-- MANIFEST.MF
> |-- ejb.jar
>       |-- META-INF
>               |-- ejb-jar.xml
>               |-- openejb-jar.xml
>               |-- MANIFEST.MF
>
> _____________________________________________________________________
> Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> http://smartsurfer.web.de/?mc=100071&distributionid=000000000066
>