users@glassfish.java.net

Re: ear file structure

From: Hong Zhang <Hong.Zhang_at_Sun.COM>
Date: Mon, 09 Jul 2007 09:49:53 -0400

The following is the relevant part in the JavaEE5 platform spec about
the bundled libraries (EE 8.2.1):

A .ear file may contain a directory that contains libraries packaged in
JAR files. The library-directory element of the .ear file’s deployment
descriptor contains the name of this directory. If a library-directory
element isn’t specified, or if the .ear file does not contain a
deployment descriptor, the directory named lib is used. An empty
library-directory element may be used to specify that there is no
library directory.
All files in this directory (but not subdirectories) with a .jar
extension must be made available to all components packaged in the EAR
file, including application clients. These libraries may reference other
libraries, either bundled with the application or installed separately,
using any of the techniques described herein.

So in this case, if you don't want to do anything with the
application.xml, you could create a "lib" directory under the ear root
and put the two library jars there.

In the current version (and previous versions) of the glassfish, we do
include all the jars at the ear root level into the classpath. But going
forward, we plan to deprecate this behavior as it's now very clear in
the platform spec how the libraries should be bundled.

Thanks,

- Hong

Shevland, Joe wrote:

>>Sorry if I have to ask this question, but I've searched
>>through the forum but could not find the relevant answer.
>>Currently I am migrating my jboss-seam apps to be deployable
>>on Glassfish. But it seems that glassfish has a different ear
>>structure with other appserver.
>>
>>My question is:
>>1. Where do I put my library in the ear file?
>>This structure is not recognized in glassfish:
>>
>>myapps.ear
>>|-- META-INF
>>|--|--application.xml
>>|-- mylibrary.jar
>>|-- anotherlibrary.jar
>>
>>
>
>It'll recognize those. Are you seeing ClassNotFoundException's or
>something?
>
>
>
>>2. What do I have to write in application.xml if I want my
>>library (that I mentioned in previous point) to be included?
>>This doesn't seem to work:
>> <module>
>> <java>mylibrary.jar</java>
>> </module>
>> <module>
>> <java>anotherlibrary.jar</java>
>> </module>
>>
>>Since *I think* glassfish will recognize it as an application client.
>>
>>
>
>By doing that, you're telling GF those two libraries are application
>clients (not what you're after). For support libs just having them in
>the root of the EAR should be fine (if all modules require them,
>otherwise WEB-INF/lib for a web app etc), nothing needed in
>application.xml. I think now with EE 5 by default you can put libraries
>under <ear_root>/lib too, a configurable property that can be pointed
>elsewhere.
>
>Cheers
>Joe
>
>This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>