Return-Path: Delivered-To: apmail-felix-dev-archive@www.apache.org Received: (qmail 77827 invoked from network); 7 Jul 2008 21:52:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Jul 2008 21:52:37 -0000 Received: (qmail 127 invoked by uid 500); 7 Jul 2008 21:52:37 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 99993 invoked by uid 500); 7 Jul 2008 21:52:37 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 99982 invoked by uid 99); 7 Jul 2008 21:52:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jul 2008 14:52:37 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [71.16.158.232] (HELO exch01.praxiseng.com) (71.16.158.232) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jul 2008 21:51:45 +0000 x-mimeole: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C8E07B.A5A8A370" Subject: RE: using pax-logger/log4j in embedded felix (class loader issue) Date: Mon, 7 Jul 2008 17:51:44 -0400 Message-ID: <9E8C2EE38A83804B8A7CD8F5C5D6BA91159688@exch01.praxislan01.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: <9E8C2EE38A83804B8A7CD8F5C5D6BA91159688@exch01.praxislan01.com> Thread-Topic: using pax-logger/log4j in embedded felix (class loader issue) Thread-Index: Acjgb/cJPYrCvvvDTrydzU+Fa5jo0wACpoyQ References: <9E8C2EE38A83804B8A7CD8F5C5D6BA91CA9402@exch01.praxislan01.com><48722342.9060203@Sun.COM><487a994c0807070715n2633f494t197355d9f82d069f@mail.gmail.com><48722D4B.6050206@Sun.COM><487a994c0807070757k7288b646pfaf77f21b6f16eaf@mail.gmail.com><48723FC5.8070108@Sun.COM><81f0d9c0807070922u7a54d80dh817810a262b40dc3@mail.gmail.com><487a994c0807071031r5a1ed56gc7735761ad274c7e@mail.gmail.com> From: "Craig Phillips" To: X-Virus-Checked: Checked by ClamAV on apache.org ------_=_NextPart_001_01C8E07B.A5A8A370 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, =20 - I can't use Equinox because I discovered a Null Pointer Exception when = attempting to restart it (in the same "context" loosely speaking -- = embedded); Also, equinox as embedded is not really "instance" based out = of the box; I logged a bug on the NPE and it's probably fixed by now, = but it's not officially released as a non-beta and that presents issues = for me that I plan to avoid; - Since I wrote the small layer that creates the Felix instance, I have = no problem tweaking that code to set the TCL to null (seems easier to do = that than replicating a context finder); =20 Dumb question - what is a TCL and how would I go about setting it to = null (I could also ask the same of the context finder approach but = setting something to null just sounds way easier) [I have written a = class loader / jar loader or two or three in my time, so I'm not totally = ignorant... just lazy if I can get away with it]... =20 Thanks, Craig ________________________________ From: hedhman@gmail.com on behalf of Niclas Hedhman Sent: Mon 7/7/2008 4:27 PM To: dev@felix.apache.org Subject: Re: using pax-logger/log4j in embedded felix (class loader = issue) On Tue, Jul 8, 2008 at 3:26 AM, Niclas Hedhman = wrote: > On Tue, Jul 8, 2008 at 1:31 AM, Karl Pauls = wrote: >> Is it somehow possible that log4j is >> doing some classloader magic itself and maybe is using the context >> classloader? The context classloader would be the WebAppClassloader I >> think ... > > Good Suggestion. Will investigate that initially. Ok. Here is the funky bits. Me and Alin Dreghiciu have both been looking at different problems today(!) turning out to be the same thing. Craig, if you took the time to try out Equinox, you would probably find that it might work in Equinox (the Spring case does), but not in Felix and not in Knopflerfish... Why? Log4J (as Spring in Alin's case) try to use the thread context classloader, if one is present, otherwise use the classloader of "itself". Hence we are seeing the Webapp classloader being used in Log4J's loading of resources, resulting in terrible mismatches. So why does it work in Equinox. Equinox sets the thread context classloader to something they call ContextFinder, which will look at the call stack, and take the first classloader found other than system CL, which would be the classloader of Pax Logging Service in your case. So, depending on how you are setting this up, you need to do "something", like either replicate the ContextFinder approach, or plainly set the TCL to null prior to loading up Felix. I would be interested to hear if that helps. Also Many Thanks to Karl who provided a 'short-cut', as the TCL was not the first thing on my mind. Cheers Niclas ------_=_NextPart_001_01C8E07B.A5A8A370--