Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 18733 invoked from network); 23 Apr 2009 14:44:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Apr 2009 14:44:36 -0000 Received: (qmail 42082 invoked by uid 500); 23 Apr 2009 14:44:36 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 42051 invoked by uid 500); 23 Apr 2009 14:44:36 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Delivered-To: moderator for user@geronimo.apache.org Received: (qmail 22138 invoked by uid 99); 23 Apr 2009 08:24:56 -0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of Martin.Sparenberg@netpioneer.de designates 85.115.14.40 as permitted sender) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C9C3EC.E9855398" Subject: Re: Changing the classloader in Geronimo Date: Thu, 23 Apr 2009 10:24:25 +0200 Message-ID: <4DFE5A2A5CFD1F4883CE843583DA6123010324AD@kim.ka.netpioneer.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Changing the classloader in Geronimo Thread-Index: AcnD7Ol7c1h97V/7RpGXL1x/vt5m4Q== From: "Martin Sparenberg" To: Cc: X-Virus-Checked: Checked by ClamAV on apache.org This is a multi-part message in MIME format. ------_=_NextPart_001_01C9C3EC.E9855398 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 = -nodes in the geronimo-web.xml but that seems not to work = here.=20 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)?)=20 I also tried with the order of the -nodes in = geronimo-web.xml. Thanks Martin -----Urspr=FCngliche Nachricht----- Von: David Jencks [mailto:david_jencks@yahoo.com] Gesendet: Donnerstag, 16. April 2009 00:42 An: user@geronimo.apache.org 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 className=3D"..."/> 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 system. 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). thanks david jencks > > > Thank you in advance, > > Martin -- Martin Sparenberg Entwickler Netpioneer GmbH, Schumannstr. 9, 10117 Berlin Gesch=E4ftsf=FChrer: Axel Jahn HRB: 107521 Handelsregister Mannheim Tel: 030 / 814 5909 34 Fax: 030 / 814 5909 30 E-Mail: Martin.Sparenberg@netpioneer.de www: http://www.netpioneer.de ------_=_NextPart_001_01C9C3EC.E9855398 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Re: Changing the classloader in Geronimo

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.

Thanks
Martin


    -----Urspr=FCngliche Nachricht-----
    Von: David Jencks [mailto:david_jencks@yahoo.com]=
    Gesendet: Donnerstag, 16. April 2009 00:42
    An: user@geronimo.apache.org
    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=3D"..."/> 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 system.

    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).

    thanks
    david jencks

    >
    >
    > Thank you in advance,
    >
    > Martin



--
Martin Sparenberg

Entwickler
Netpioneer GmbH, Schumannstr. 9, 10117 Berlin
Gesch=E4ftsf=FChrer: Axel Jahn
HRB: 107521 Handelsregister Mannheim

Tel: 030 / 814 5909 34
Fax: 030 / 814 5909 30
E-Mail: Martin.Sparenberg@netpioneer.de
www: http://www.netpioneer.de

------_=_NextPart_001_01C9C3EC.E9855398--