Return-Path: Delivered-To: apmail-felix-dev-archive@www.apache.org Received: (qmail 16753 invoked from network); 7 Jul 2008 15:25:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Jul 2008 15:25:04 -0000 Received: (qmail 26811 invoked by uid 500); 7 Jul 2008 15:25:04 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 26766 invoked by uid 500); 7 Jul 2008 15:25:04 -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 26755 invoked by uid 99); 7 Jul 2008 15:25:04 -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 08:25:04 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mcculls@gmail.com designates 74.125.92.146 as permitted sender) Received: from [74.125.92.146] (HELO qw-out-1920.google.com) (74.125.92.146) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jul 2008 15:24:11 +0000 Received: by qw-out-1920.google.com with SMTP id 5so6212qwf.16 for ; Mon, 07 Jul 2008 08:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type:references :x-google-sender-auth; bh=mX9BY/e8kXk4Amkkw/f7qPv/J+uuxQhMR2BuzlOpkGU=; b=Ru1vCRydWBRKVR3Gh3+hDZNe7EQRVyH0UBxO3rV9+X2cuP0KukkYZquHsjBIfwC+62 U21le6VQVVJoL0301zs5nm8t125PogbFuyzeg4so5fQGt1s/Bga6my7SUEk1ZOwOdzus 8SaA/QFUE0FfpT92DO272drsoWC4g8fK2qrTY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:references:x-google-sender-auth; b=Aih0Ifzh6/PDQkdMfm1jlBbE+LXUd02pxxOq9tULFX4iuSiS5FhPvy0eoLObida1SI akuu2UgqLylcfOynQ2g/Tgt5iGPXOdNYuVtsuCVTWoXaE0NvL5zIwnNZ7TQWot00VDyk owMQSQmJ/iYDSAXQGWtzDM1QCEP48JAB3m9bs= Received: by 10.150.52.2 with SMTP id z2mr8411655ybz.46.1215444272381; Mon, 07 Jul 2008 08:24:32 -0700 (PDT) Received: by 10.151.102.17 with HTTP; Mon, 7 Jul 2008 08:24:32 -0700 (PDT) Message-ID: <81f0d9c0807070824q2e83e5bei99beeea8d59bb554@mail.gmail.com> Date: Mon, 7 Jul 2008 23:24:32 +0800 From: "Stuart McCulloch" Sender: mcculls@gmail.com To: dev@felix.apache.org Subject: Re: using pax-logger/log4j in embedded felix (class loader issue) Cc: "General OPS4J" In-Reply-To: <48722D4B.6050206@Sun.COM> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_34711_15043870.1215444272380" References: <9E8C2EE38A83804B8A7CD8F5C5D6BA91CA9402@exch01.praxislan01.com> <48722342.9060203@Sun.COM> <487a994c0807070715n2633f494t197355d9f82d069f@mail.gmail.com> <48722D4B.6050206@Sun.COM> X-Google-Sender-Auth: 125ec723f99097cf X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_34711_15043870.1215444272380 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 2008/7/7 Sahoo : > Karl Pauls wrote: > >> On Mon, Jul 7, 2008 at 4:08 PM, Sahoo wrote: >> >> >>> log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not >>>> assignable to a " >>>> >>>> org.apache.log4j.Appender" variable. >>>> >>>> log4j:ERROR The class "org.apache.log4j.Appender" was loaded by >>>> >>>> log4j:ERROR [7.0] whereas object of type >>>> >>>> log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by >>>> [WebappClassLoader >>>> >>>> delegate: false >>>> >>>> >>>> >>>> >>> As someone already pointed out, this seems to be the real issue. >>> >>> >> >> Why would that be an issue? >> >> >> > WebappClassLoader, which is what the war uses to load any class, has loaded > ConsoleAppender as well as the interface Appender. In the OSGi classloading > space, Appender is loaded by some bundle's class loader. I was thinking that > somehow the ConsoleAppender as loaded by the application class loader is > coming in contact with Appender which is loaded by a bundle. > >> Try setting the following in felix/config.properties file or whatever >>> equivalent way to >>> pass it while invoking Felix using an API: >>> >>> org.osgi.framework.bootdelegation=sun.*,com.sun.*, org.apache.log4j.* >>> I am not suggesting this as a long term solution, but this can take us >>> towards the solution. >>> >>> >> >> How? >> >> >> > Since Felix is started by the web app, Felix would use that web app's class > loader for any delegation. By having this property, both OSGi bundles should > see same log4j classes as the web app. > however, setting this would break Pax-Logging, because then the application would load the Log4J public API classes from the standard Log4J jar - rather than the custom classes from Pax-Logging that fix Log4J logging for OSGi note you can use mandatory attributes in your manifest if you want to ensure that bundles always use the Log4J public classes provided by Pax-Logging: http://www.ops4j.org/projects/pax/logging/userguide.html wrt. the error - the Appender class is probably from the Pax-Logging service bundle, which has a Log4J backend - however, this is private to the bundle and also contains ConsoleAppender, so it's strange that these two classes are being loaded by different classloaders it looks like the web containers classes are somehow visible to the bundles, although the Felix classloader should be keeping them hidden (unless the bootdelegation property is set) Thanks, > Sahoo > >> regards, >> >> Karl >> >> >> >>> Thanks, >>> Sahoo >>> >> -- Cheers, Stuart ------=_Part_34711_15043870.1215444272380--