Return-Path: Delivered-To: apmail-felix-users-archive@minotaur.apache.org Received: (qmail 82956 invoked from network); 6 Mar 2009 08:56:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Mar 2009 08:56:34 -0000 Received: (qmail 10922 invoked by uid 500); 6 Mar 2009 08:56:33 -0000 Delivered-To: apmail-felix-users-archive@felix.apache.org Received: (qmail 10897 invoked by uid 500); 6 Mar 2009 08:56:33 -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 10886 invoked by uid 99); 6 Mar 2009 08:56:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2009 00:56:33 -0800 X-ASF-Spam-Status: No, hits=2.4 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [68.230.241.45] (HELO fed1rmmtao101.cox.net) (68.230.241.45) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2009 08:56:23 +0000 Received: from fed1rmimpo01.cox.net ([70.169.32.71]) by fed1rmmtao101.cox.net (InterMail vM.7.08.02.01 201-2186-121-102-20070209) with ESMTP id <20090306085601.OWZL27308.fed1rmmtao101.cox.net@fed1rmimpo01.cox.net> for ; Fri, 6 Mar 2009 03:56:01 -0500 Received: from mail.cox.net ([98.164.209.121]) by fed1rmimpo01.cox.net with bizsmtp id Pkw11b00B2dhxHN03kw2FK; Fri, 06 Mar 2009 03:56:02 -0500 X-Authority-Analysis: v=1.0 c=1 a=pGLkceISAAAA:8 a=kviXuzpPAAAA:8 a=2V6DY6BgAAAA:8 a=mV9VRH-2AAAA:8 a=EQP5a0rplAyDHix1mWUA:9 a=_epBdZvS_p_Ri3-SosQA:7 a=j59N7xaKJGiMovIscUb3rwOLLNQA:4 a=6-x43y6uxGMA:10 a=D6URjsxiI9IA:10 a=MSl-tDqOz04A:10 a=4vB-4DCPJfMA:10 X-CM-Score: 0.00 Date: Fri, 06 Mar 2009 00:55:53 -0800 To: users@felix.apache.org Subject: Re: Classloader Question From: "Pete Haidinyak" Organization: Village Idiots Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 References: <81f0d9c0903060025p603a86e6y47bdea959e8a099e@mail.gmail.com> Content-Transfer-Encoding: 7bit Message-ID: In-Reply-To: User-Agent: Opera Mail/9.64 (Win32) X-Virus-Checked: Checked by ClamAV on apache.org 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. >> ================= >> >> -> 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 >> assignable >> 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 >> ID State Level Name >> [ 0] [Active ] [ 0] System Bundle (1.4.1) >> [ 1] [Active ] [ 1] Apache Felix Shell Service (1.0.2) >> [ 2] [Active ] [ 1] Apache Felix Shell TUI (1.0.2) >> [ 3] [Active ] [ 1] Apache Felix Bundle Repository (1.2.1) >> [ 4] [Resolved ] [ 1] Apache Jakarta log4j Plug-in >> (1.2.13.v200706111418) >> [ 5] [Active ] [ 1] 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 { >> public void start(BundleContext context) throws Exception { >> Logger logger = Logger.getLogger(Activator.class); >> logger.info("Info starting"); >> logger.warn("Warning starting"); >> logger.error("Error starting"); >> } >> public void stop(BundleContext context) throws Exception { >> Logger logger = Logger.getLogger(Activator.class); >> logger.info("Info stopping"); >> logger.warn("Warning stopping"); >> logger.error("Error stopping"); >> } >> } >> >> >> 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: >> >> 2009/3/6 Stevens Gestin >>> >>> Hi, >>>> >>>> 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. >>>> > My question is I thought OSGi isolated the bundles from each other >>>> 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