Bistro!
Alexis Moussine-Pouchkine's Weblog
public enum Topic { Java, GlassFish, Tools, Sun, InFrenchInZeText, SDPY }

20090415 mercredi avril 15, 2009

More with "deploy --libraries" in GlassFish

A few months back Sahoo mentioned the use of "asadmin deploy --libraries" in the comments section as an effective way to deal with libraries. I recently had two people ask me about the behavior of GlassFish when multiple applications are deployed with --libraries pointing to the set jar file so I thought I'd share here what I found (this is for GlassFish v2.x). Thanks to Siva and Hong for the help there.

When multiple applications have --libraries pointing to the same jar, the classloading infrastructure tries to "share" the jar by loading it in the same classloader.

A side effect of this is that modifications to the jar require the undeployment and deployment of the application (along with its --libraries option) for it to use the updated version of the library. A simple deployment will trigger a ClassNotFoundException.

Note that it is your responsibility to keep track of all the applications using a given library and to do an undeploy/deploy for all of them as you may otherwise end up having different applications using different versions of the library.

The other option, which doesn't require the keep track of the applications using a given library, is to update the library bits and simply restart the server. Of course that has other drawbacks...

( avr. 15 2009, 02:08:00 PM CEST ) Permalink

Comments:

Post a Comment:

Comments are closed for this entry.

GlassFish Podcast
Get GlassFish V3
Support GlassFish Enterprise

Today's Page Hits: 605




bea conference glassfish groovy ips java javaee javafx javaone javazone jug mysql netbeans openesb openoffice opensource paris performance pkg podcast presentation sdpy spring sun swing techdays tips updatecenter v3 webservices
Links