users@glassfish.java.net

Classloader Hierarchy in Glassfish using deployed Resource adapters

From: Gustavo Henrique Orair <gustavo.orair_at_gmail.com>
Date: Mon, 23 Jan 2012 10:54:49 -0200

I'm having problems with classloading when using Glassfish ResourceAdapters.
By deploying rar, their libraries seem to take precedence to both
Glassfish libraries and application libraries itself.

When deploying jackrabbit JCA with global classloading , this resulted
in a conflict in the ejb-timer-service that used the derby library
because there was a different derby version inside the jackrabbit.rar.

In addition, my application uses the Logback and has the file
logback.xml with the settings of the Logging system. But it seems that
the classloader system first the logback.xml inside a library jar
(jackrabbit-jca.jar) within the resource adapter jackrabbit-jca.rar.
So, it used the logback.xml shipped within jackrabbit-jca.rar instead
of my own configuration.

I would like to understand better the priority rules of loading when
using Resource Adapters.

This problem results in several other classloading problems such as
commons-io inside the jackrabbit-jca.rar is at version 1.4 and my
application uses version 2.0.1.

Is there any way to "isolate" the Rar libraries for use only in
classes inside this rar? What's the best approach to avoid all these
conflicts?

If anyone has faced these problems in a similar environment, what is
the recommended way to configure this environment?

---------------------------------------------------------------------------------------------------------------------
                               Gustavo Henrique Orair
------------------------------------------------------------------------------------------------------------------