lundi janv. 31, 2011

Packaging libraries with EARs

This blog has moved to alexismp.wordpress.com
Follow the link for the most up-to-date version of this blog entry.

Hong's recent packaging response on the GlassFish Forum reminded me of other similar problems faced by GlassFish users.

When packaging applications in an EAR file, the library JARs need to be placed in the archive lib directory (jars at the archive root level are not added to the classpath and thus available from other EAR artifacts..

The library jars placed in the "/lib" directory of the EAR (the directory name can be overridden in application.xml) will be visible to all sub-modules (JARs, WARs, and RARs) with no further configuration. No need to add Class-Path entries in the EAR manifest.

In the sub-modules, you can use Class-Path entries to explicitly reference library JAR files you may need.

Of course you can also "install" those libraries in the GlassFish "/lib" directory but you may run into other problems since they would be visible and shared from all applications.

GlassFish also offers a asadmin deploy --libraries foo.jar option (something a good number of people end up using when looking for an equivalent to "shared libraries" offered by other containers).

Then of course, if you're like most server-side Java developer you could probably put your application on a diet and remove a few of those JARs to use what's already in the platform.

About

This blog has moved

Alexis Moussine-Pouchkine's Weblog

GlassFish - Stay Connected

Search

Archives
« avril 2014
lun.mar.mer.jeu.ven.sam.dim.
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today
Blogroll

No bookmarks in folder

News

No bookmarks in folder