users@glassfish.java.net

Re: Using Hibernate on Glassfish?

From: Sahoo <sanjeeb.sahoo_at_oracle.com>
Date: Wed, 04 May 2011 22:21:18 +0530

On Wednesday 04 May 2011 06:54 PM, Richard Kolb wrote:
> Hi Sahoo
>
> On 4 May 2011 15:11, Sahoo <sanjeeb.sahoo_at_oracle.com
> <mailto:sanjeeb.sahoo_at_oracle.com>> wrote:
>
> Mitesh's proposal does not require use of Hibernate as a set of
> OSGi bundles. Just copy Hibernate and its dependencies to
> domain/lib and you should be done. GlassFish's use of SLF4J won't
> be affected, because GlassFish neither exposes its SLF4J
> implementation to user apps nor does it get affected by user's
> SLF4J bindings.
>
> If you don't want every application to see every jar that
> Hobernate uses, there is a better solution which will allow you to
> install multiple versions of Hibernate in GlassFish and yet share
> it by different applications. Do the following:
>
> copy hobernate and its dependencies into a directory called
> domain1/lib/applib/hibernate-xxx/
> create an empty jar in domain1/lib/applib/hibernate-latest.jar
> with MANIFEST.MF having Class-Path entry set to all hibernate
> jars. e.g., it may look like this:
> Class-Path: hibernate-xxx/foo.jar hibernate-xxx/bar.jar ...
>
> From each that uses this version of hibernate, specify --library
> hibernate-xxx.jar while deploying.
>
>
> Very nice feature.
>
> Is this documented some place ?
> From which Glassfish version was this introduced ?
--library option is available in every version of GlassFish IIRC, so it
is 4-5 years old feature. It must be documented both in deploy man page
as well as deployment guide. You probably won't find any documentation
around use of Class-Path manifest along with --library option, because
that's just an example of how something else can be combined with
--library option to give a different flavor.