Return-Path: Delivered-To: apmail-felix-users-archive@minotaur.apache.org Received: (qmail 25970 invoked from network); 6 Mar 2009 09:58:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Mar 2009 09:58:47 -0000 Received: (qmail 88376 invoked by uid 500); 6 Mar 2009 09:58:46 -0000 Delivered-To: apmail-felix-users-archive@felix.apache.org Received: (qmail 88349 invoked by uid 500); 6 Mar 2009 09:58:46 -0000 Mailing-List: contact users-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@felix.apache.org Delivered-To: mailing list users@felix.apache.org Received: (qmail 88338 invoked by uid 99); 6 Mar 2009 09:58:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2009 01:58:46 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of adreghiciu@gmail.com designates 209.85.218.172 as permitted sender) Received: from [209.85.218.172] (HELO mail-bw0-f172.google.com) (209.85.218.172) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2009 09:58:36 +0000 Received: by bwz20 with SMTP id 20so297638bwz.22 for ; Fri, 06 Mar 2009 01:58:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=lyCvKRdkZSENEW0VAWwBRYnFddPsMECIGqsHV9OALLo=; b=Ry0ztuTY4wDwdcqI/oQ/ZbHZlv9mS9B8MV3+IYNtnNUxOTa1N4SywZmLXKKyvlrIZh Duu6YOWddM2SNQBMd5B1qV9TQ45bqsOS4P2YsnRS4Jn9tvji5Oo0GIk2hyMgj5umkEnN ReSXMzXxDA2ff0C0RBAJFr0Rp+3HkdrR5zvz4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=dBLWuHwSowlkqHORv2mDso+Z4RCfRl5pCqnGJW7s1X+yvxSa3ErnvlwG+Yd2H8HouG x2CdYsm4uMjHeM0qPvUFB69xqJ6Ozx0PwjcRfVu6tq9xoyCkkelM1iyfKGEZneQuseKO uBRqLjIo1Id1+3TIULPSOxn7StQihyh51QEvI= MIME-Version: 1.0 Received: by 10.223.113.9 with SMTP id y9mr1830006fap.61.1236333495130; Fri, 06 Mar 2009 01:58:15 -0800 (PST) In-Reply-To: References: <81f0d9c0903060025p603a86e6y47bdea959e8a099e@mail.gmail.com> Date: Fri, 6 Mar 2009 11:58:15 +0200 Message-ID: <87eb8aee0903060158r625243eekbdc372af4e9fae28@mail.gmail.com> Subject: Re: Classloader Question From: Alin Dreghiciu To: users@felix.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org So, in the setup where you get the error is the system packages extra containing the log4j packages exposed from the classloader that embeds Felix? If yes, then bundle 4 should not be there. Of course if bundle 4 is log4 it= self. On Fri, Mar 6, 2009 at 10:55 AM, Pete Haidinyak wrote: > No, that was one solution proposed to me was to not have the log4j bundle > and just expose it using the system packages extra. > > -Pete > > On Fri, 06 Mar 2009 00:53:40 -0800, Stevens Gestin > wrote: > >> So you just have to add "org.apache.log4j" to Felix system packages >> property. >> >> Stevens >> >> On Fri, Mar 6, 2009 at 9:44 AM, Pete Haidinyak wrote: >> >>> Sorry about that, it was more of a question about the classloading than >>> to >>> fix an issue. Anyway here is the error message... >>> >>> D:\Annotation\felix>java -cp org.apache.log4j.jar;bin\felix.jar;.\conf >>> org.apache.felix.main.Main >>> >>> Welcome to Felix. >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> >>> -> install file:org.apache.log4j.jar >>> Bundle ID: 4 >>> -> install file:log4jdemo.jar >>> Bundle ID: 5 >>> -> start 5 >>> log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignab= le >>> to a "org.apache.log4j.Appender" variable. >>> log4j:ERROR The class "org.apache.log4j.Appender" was loaded by >>> log4j:ERROR [4.0] whereas object of type >>> log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by >>> [sun.misc.Launcher$AppClassLoader@11b86e7]. >>> log4j:ERROR Could not instantiate appender named "default". >>> log4j:WARN No appenders could be found for logger (log4jdemo.Activator)= . >>> log4j:WARN Please initialize the log4j system properly. >>> -> ps >>> START LEVEL 1 >>> =A0ID =A0 State =A0 =A0 =A0 =A0 Level =A0Name >>> [ =A0 0] [Active =A0 =A0 ] [ =A0 =A00] System Bundle (1.4.1) >>> [ =A0 1] [Active =A0 =A0 ] [ =A0 =A01] Apache Felix Shell Service (1.0.= 2) >>> [ =A0 2] [Active =A0 =A0 ] [ =A0 =A01] Apache Felix Shell TUI (1.0.2) >>> [ =A0 3] [Active =A0 =A0 ] [ =A0 =A01] Apache Felix Bundle Repository (= 1.2.1) >>> [ =A0 4] [Resolved =A0 ] [ =A0 =A01] Apache Jakarta log4j Plug-in >>> (1.2.13.v200706111418) >>> [ =A0 5] [Active =A0 =A0 ] [ =A0 =A01] Log4JDemo Plug-in (1.0.0) >>> -> >>> >>> >>> The log4j.xml file is in the .\conf folder, that's why that is in the >>> classpath. >>> >>> The Log4JDemo consists of... >>> >>> package log4jdemo; >>> >>> import org.apache.log4j.Logger; >>> import org.osgi.framework.BundleActivator; >>> import org.osgi.framework.BundleContext; >>> >>> public class Activator implements BundleActivator { >>> =A0 =A0 =A0 public void start(BundleContext context) throws Exception { >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 Logger logger =3D Logger.getLogger(Activato= r.class); >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 logger.info("Info starting"); >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 logger.warn("Warning starting"); >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 logger.error("Error starting"); >>> =A0 =A0 =A0 } >>> =A0 =A0 =A0 public void stop(BundleContext context) throws Exception { >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 Logger logger =3D Logger.getLogger(Activato= r.class); >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 logger.info("Info stopping"); >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 logger.warn("Warning stopping"); >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 logger.error("Error stopping"); >>> =A0 =A0 =A0 } >>> } >>> >>> >>> Removing the log4j jar from the classpath removes the errors. >>> >>> Thanks for all of your help.. >>> >>> -Pete >>> >>> >>> >>> On Fri, 06 Mar 2009 00:25:24 -0800, Stuart McCulloch >>> wrote: >>> >>> =A02009/3/6 Stevens Gestin >>>> >>>> =A0Hi, >>>>> >>>>> without an hint on your error it's a bit difficult to help. >>>>> >>>>> >>>> yes, seeing the actual error or exception trace would be useful >>>> as well as your settings for system packages / bootdelegation >>>> >>>> also note that while OSGi attempts to isolate bundles, because >>>> it runs on top of the JVM it is still possible for code to get access >>>> to other classloaders by techniques such as reflection, or simply >>>> by calling getClassLoader() on a passed in type or instance. >>>> >>>> complete isolation is only possible with low-level runtime support >>>> >>>> Stevens >>>> >>>>> >>>>> On Fri, Mar 6, 2009 at 7:07 AM, Pete Haidinyak >>>>> wrote: >>>>> >>>>> > I am embedding Felix in an application I am porting and was playing >>>>> around >>>>> > with logging with Log4j. I wanted both the application and Felix to >>>>> > use >>>>> > Log4j. I put the Log4j jar in the classpath and loaded a Log4j >>>>> > bundle. >>>>> I >>>>> was >>>>> > getting an error doing this. >>>>> > =A0My question is I thought OSGi isolated the bundles from each oth= er >>>>> > and >>>>> the >>>>> > classpath unless you tell it other wise. Why would having log4j on >>>>> > the >>>>> > classpath cause a bundle to have problems? >>>>> > >>>>> > THanks >>>>> > >>>>> > -Pete >>>>> > >>>>> > >>>>> > -------------------------------------------------------------------= -- >>>>> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org >>>>> > For additional commands, e-mail: users-help@felix.apache.org >>>>> > >>>>> > >>>>> >>>>> >>>>> -- >>>>> Le respect commence par celui de l'environnement >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org >>> For additional commands, e-mail: users-help@felix.apache.org >>> >>> >> >> > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org > For additional commands, e-mail: users-help@felix.apache.org > > --=20 Alin Dreghiciu http://www.ops4j.org - New Energy for OSS Communities - Open Participation Software. http://www.qi4j.org - New Energy for Java - Domain Driven Development. http://www.codedragons.com - New Energy for Projects - Great People working on Great Projects at Great Places Sent from: Cluj-napoca Cj Romania. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@felix.apache.org For additional commands, e-mail: users-help@felix.apache.org