geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sparenberg" <>
Subject Re: Changing the classloader in Geronimo
Date Thu, 23 Apr 2009 08:24:25 GMT
Hi David,

1st I'd like to apologize for my late reply to your help.
I am now trying with your approach (1), the repository entries. So far it looks good, but
I still encounter a problem with loading dependent classes. In one jar there are classes referenced
from the tomcat-jar. I thought I could name those "dependencies of dependencies" as additional
<dependency>-nodes in the geronimo-web.xml but that seems not to work here. 
When deploying/starting the application I still get a java.lang.NoClassDefFoundError. Copying
the required geronimo-tomcat6-2.1.4.jar next to my jar into the repository didn't work either,
as well as putting it into one of the lib-directories of the server or the application. (Shouldn't
it be found always as it is part of geronimo(running with tomcat)?) 
I also tried with the order of the <dependency>-nodes in geronimo-web.xml.


    -----Ursprüngliche Nachricht-----
    Von: David Jencks []
    Gesendet: Donnerstag, 16. April 2009 00:42
    Betreff: Re: Changing the classloader in Geronimo

    On Apr 15, 2009, at 8:47 AM, Martin Sparenberg wrote:

    > Hi,
    > this is probably an uncommon problem, but maybe someone encountered a
    > similar situation and knows a solution:  :)
    > We have a build environment with a heavy amount of jar files that are
    > too much to copy for test-runs into the app structure (WEB- INF/...).
    > (ok, this is also very inhouse-special, never mind ;) ) When using a
    > plain tomcat environment in the past we take a customized classloader
    > that knows the special locations of the libs and puts the fs paths of
    > them to the classpath.
    > Now we want to switch to geronimo (as the application is to be more
    > jee-ified).
    > I found several options for configuring geronimo's classloader but up
    > to now I found no way for replacing it by an own extension. :( In
    > tomcat I can name an own loader in WEB-INF/ROOT.xml as <Loader
    > className="..."/> but that didn't work in Geronimo (or is it just
    > another file?).
    > I "played around a bit" with the gbean settings in the geronimo-
    > web.xml but without success.
    > Is there a way for replacing/extending the classloader used for my
    > application in Geronimo?
    > Or (ever better) is there a way to get to my jars on their team
    > environment places in the filesystem just by configuration? As I
    > understand, the 'dependency' tags in geronimo-web.xml refers "only"
    > to the libs in the servers's repository.

    There are a lot of choices.  Which one you choose may depend on your goals for your build

    There are three classes of solution:

    1.  Get the jars into the appropriate places in the geronimo repository and reference
them as dependencies in your geronimo-web.xml environment element.  This is easiest if you
like maven.  In this case the jars will all be in the application classloader.
    -a. assemble a custom server including the jars -b use a gshell script to install the
jars into an existing geronimo server -c build your application as a geronimo plugin: installing
it in a geronimo server will pull in all the dependencies  from a suitable maven repo.  If
the jars are already there, just your app will be installed -d A final possibility for this
approach is to assemble a custom server around your applicatiion deployed as a geronimo plugin:
this gives you an easy to distribute complete server including your app.

    2. use the shared-lib in geronimo: put all the jars in the shared lib directory.  You
can alter what this directory is if you don't like the
    default location.  In this case the jars will all be in a parent
    classloader to the application classloader.  I consider this a nasty hack but a lot of
people find this useful.

    3. deploy your application in-place exploded.  In this case you'll only be changing bits
of code and redeploying, the jars will presumably stay unchanged in the WEB-INF/lib directory
in your exploded war.

    I greatly prefer all the options under (1).

    david jencks

    > Thank you in advance,
    > Martin

Martin Sparenberg

Netpioneer GmbH, Schumannstr. 9, 10117 Berlin
Geschäftsführer: Axel Jahn
HRB: 107521 Handelsregister Mannheim

Tel: 030 / 814 5909 34
Fax: 030 / 814 5909 30

View raw message