users@glassfish.java.net

Re: Using Hibernate on Glassfish?

From: Laird Nelson <ljnelson_at_gmail.com>
Date: Wed, 4 May 2011 14:05:10 -0400

On Wed, May 4, 2011 at 1:57 PM, Sahoo <sanjeeb.sahoo_at_oracle.com> wrote:

> On Wednesday 04 May 2011 10:56 PM, Laird Nelson wrote:
>
> On Wed, May 4, 2011 at 9:11 AM, Sahoo <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.
>>
>
> Good to know.
>
> One of Hibernate's "required" dependencies is a jar full of
> javax.transaction.* interfaces. It ships with this. I presume I would
> NOT include this jar in any of these scenarios, since surely it is already
> provided by Glassfish? Or maybe it's OK to pull it in in this manner...?
>
> GlassFish uses a hierarchical class loader for regular Java EE applications
> with some caveats. Even if you include Java EE API classes in your
> applications, they won't be picked up from application space. Instead they
> will be picked up from glassfish internal jars. So, it does not matter if
> you copy javax.transaction.jar into applib or not. If you search this forum,
> you will find some postings about our class loader hierarchy in v3.x series.
>

Sure; I suspected as much--I'm glad to hear it confirmed. It would seem
then that jta.jar will simply be ignored if it is installed alongside
Hibernate.


> GlassFish bundled antlr is not available to applications. GlassFish uses
> OSGi techniques to hide its implementation classes from leaking into user
> apps. See http://java.net/jira/browse/GLASSFISH-5385 for details. This is
> not always correctly configured, but I checked it is done correctly for
> antlr.
>

OK. So in general then, any libraries installed in applib should Just
Work™.

I will write up yet another blog entry on this subject at
ljnelson.posterous.com.

Best,
Laird