users@glassfish.java.net

Re: Glassfish v3 classloader - load order

From: Sanjeeb Sahoo <sahoo_at_sun.com>
Date: Thu, 03 Jun 2010 21:49:16 +0530

So you have multiple jars in lib dir and they have same named class with
different contents and you want to control their order so that a
particular jar is used to load the given class? Did I get it right? If
you used ClassPath option of v2, then that was a bad choice IMO.
classpath prefix/suffix is not meant for libraries used by applications;
they are meant for libraries used by the server. One way to address the
order is to do something like this:

Let's say you want to order a.jar and b.jar in domain1/lib/
cd domain1/lib/
mkdir jars/
mv a.jar b.jar ./jars/
Create a new jar called ab.jar which only has a MANIFEST.MF file. Add a
Class-Path attribute like this in the manifest file:
Class-Path: jars/a.jar jars/b.jar

To create such a jar, do the following:

vi manifest
Add the entry in the file.
jar cvfm ab.jar manifest

HTH,
Sahoo

On Thursday 03 June 2010 08:58 PM, glassfish_at_javadesktop.org wrote:
> Hi,
>
> One of our applications containing same classes in several jars and they are different of course :) in sjas 8.2 we can set classpath directly but in glasfish v3 it is not possible.
> Is there any way to change the loading order of file in lib directory in Glassfish v3 (for example force loading files in alphabetical order) ?
>
> Thanks in advance,
>
> Arp
> [Message sent by forum member 'abogothy']
>
> http://forums.java.net/jive/thread.jspa?messageID=472598
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>