users@glassfish.java.net

GF 3.1.1 Classloading issue ... how to tackle it?

From: Bernhard Thalmayr <bernhard.thalmayr_at_painstakingminds.com>
Date: Thu, 24 Nov 2011 15:32:44 +0100

Hi experts, ... this is a hard one ...

I'm using OpenAM/OpenSSO Policy Agent with GF 3.1.1 ... it needs to place
library jars into <domaindir>/lib as it creates a custom realm for GF.

The 'realm' uses library 'X' to load it's properties from file 'Y'

Having an EAR with and EJB module ..

a business method of the EJB also uses methods from library 'X' but, this
time the library should read a different set of proprties from file 'Z'.

Due to classloader delegation the classes of the library are loaded (my
assumption) by the common classloader and the properties-file (which is
packaged in the archive) is not found.


If I create a WAR and set 'delegate=false' in glassfish-web.xml I can make
it work either by
- packaging the property file with the app
or
-putting the property file in a jar, placing it in <domain-dir>/lib/applibs
and using --libraries <jar-file> when deploying the WAR.

How can I achieve the same behaviour for an enterprise application?

I can not place the jar with the library into <domain-dir>/lib because then
the agent will read the wrong properties.

TIA,
Bernhard

-- 
IT-Consulting Bernhard Thalmayr
- Painstaking Minds -
83620 Vagen (Munich area)
Germany