felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Phillips" <lcphill...@praxiseng.com>
Subject RE: using pax-logger/log4j in embedded felix (class loader issue)
Date Mon, 07 Jul 2008 14:37:29 GMT
Karl,

I can send you a zip in a few...

Re: strange... yeah... I want to believe that I should not have any
class loader issues in OSGi in that I simply rely on the manifests and
then "world is good"... Of course, I rely on the BND tool, which I
couldn't live without, incidentally (I avoid maven like the plague, but
that's another discussion)...

In my list parameter, I just do the Main.loadProperties() and then add
my Felix config.properties from before....

Now, Pax-Logger et al is very heavyweight, and it uses the following
config:

log4j.rootLogger=DEBUG, A8
log4j.appender.A8=org.apache.log4j.ConsoleAppender
log4j.appender.A8.layout=org.apache.log4j.PatternLayout

I'll try to whip up a zip in a few... thanks, Craig

-----Original Message-----
From: Karl Pauls [mailto:karlpauls@gmail.com] 
Sent: Monday, July 07, 2008 10:11 AM
To: dev@felix.apache.org
Subject: Re: using pax-logger/log4j in embedded felix (class loader
issue)

Strange. Somehow a class is loaded from the outside and then used
inside a bundle...

Are you maybe bridging something from the outside to the inside (maybe
via the list parameter in the felix constructor)?

Can you make an example that fails available to me (either send it to
me directly or create a jira issue and attach it there)?

regards,

Karl

On Mon, Jul 7, 2008 at 1:44 PM, Craig Phillips
<lcphillips@praxiseng.com> wrote:
> Hi,
>
> Hmmm... looks like the dev mailing list doesn't like attachments...
OK,
> I'll copy/paste the thing in... again, this would work if you run
> felix.jar standalone...  I'm not going to do all the jre entries, they
> go on forever...  Craig
>
> org.osgi.framework.system.packages=org.osgi.framework; version=1.3.0,
\
>  org.osgi.service.packageadmin; version=1.2.0, \
>  org.osgi.service.startlevel; version=1.0.0, \
>  org.osgi.service.url; version=1.0.0, \
>  org.osgi.util.tracker; version=1.3.2 \
>  ${jre-${java.specification.version}}
>
> #
> # LCP - This next section of entries are the entries that are
typically
> edited:
> # file:../webapps/craigbox/WEB-INF/lib/pax-logging-service-1.0.0.jar \
> #
> felix.auto.start.1= \
>  file:../webapps/craigbox/WEB-INF/lib/org.apache.felix.shell-1.0.1.jar
\
>  file:../webapps/craigbox/WEB-INF/lib/org.osgi.compendium-1.0.1.jar \
>  file:../webapps/craigbox/WEB-INF/lib/org.apache.felix.scr-1.0.0.jar \
>
>
file:../webapps/craigbox/WEB-INF/lib/org.apache.felix.configadmin-1.0.1.
> jar \
>
file:../webapps/craigbox/WEB-INF/lib/pax-confman-propsloader-0.2.1.jar
> \
>  file:../webapps/craigbox/WEB-INF/lib/pax-logging-api-1.0.0.jar \
>  file:../webapps/craigbox/WEB-INF/lib/org.craig.play.Play01.jar
> felix.cache.profile=felix_starter
> felix.cache.dir=../webapps/craigbox/WEB-INF/felix_cache
> felix.embedded.execution=true
>
> felix.log.level=4
> felix.startlevel.framework=1
> felix.startlevel.bundle=1
> osgi.shell.telnet=on
> #felix.service.urlhandlers=false
> #org.osgi.framework.bootdelegation=sun.*,com.sun.*
>
> #
> # Bundle config properties.
> #
> org.osgi.service.http.port=8080
> osgi.shell.telnet=on
>
#obr.repository.url=http://bundles.osgi.org/obr/browse?_xml=1&cmd=reposi
> tory
>
>
> #
> # Java platform package export properties.
> #
> jre-1.3=, \
>  javax.accessibility; \
>  javax.naming; \
>  javax.naming.directory; \
>  javax.naming.event; \
> etc etc etc
>
> -----Original Message-----
> From: Karl Pauls [mailto:karlpauls@gmail.com]
> Sent: Monday, July 07, 2008 7:33 AM
> To: dev@felix.apache.org
> Subject: Re: using pax-logger/log4j in embedded felix (class loader
> issue)
>
> Could you maybe post your complete config.properties?
>
> regards,
>
> Karl
>
> On Mon, Jul 7, 2008 at 12:59 PM, Craig Phillips
> <lcphillips@praxiseng.com> wrote:
>> Hi, I probably need to direct this to PAX, but I'll try here (felix
> dev)
>> first... Sorry to trouble you, if anyone with felix class loader
>> intimacy could take a look, I'd be appreciative... for a logger, this
>> isn't critical and I'll probably just write my own simple FileLogger
>> that implements LogService, but I suspect there are bigger issues at
>> play... Some background...
>>
>>
>>
>> I'm embedding felix in a class that is being run within a tomcat
> web-app
>> (dot.jsp initiated - just as a driver/tester); Hence, I'm doing a
'new
>> Felix(map, list)' and invoking the 'felix.start()' method... Here's
my
>> config.properties auto.start list:
>>
>>
>>
>> file:../webapps/craigbox/WEB-INF/lib/org.apache.felix.shell-1.0.1.jar
> \
>>
>> file:../webapps/craigbox/WEB-INF/lib/org.osgi.compendium-1.0.1.jar \
>>
>> file:../webapps/craigbox/WEB-INF/lib/org.apache.felix.scr-1.0.0.jar \
>>
>>
>
file:../webapps/craigbox/WEB-INF/lib/org.apache.felix.configadmin-1.0.1.
>> jar \
>>
>>
file:../webapps/craigbox/WEB-INF/lib/pax-confman-propsloader-0.2.1.jar
> \
>>
>> file:../webapps/craigbox/WEB-INF/lib/pax-logging-api-1.0.0.jar \
>>
>> file:../webapps/craigbox/WEB-INF/lib/pax-logging-service-1.0.0.jar \
>>
>> file:../webapps/craigbox/WEB-INF/lib/org.craig.play.Play01.jar
>>
>>
>>
>> Anyway, here are the applicable ERROR log entries, seemingly coming
> from
>> pax:
>>
>>
>>
>> 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
>>
>>  repositories:
>>
>> ----------> Parent Classloader:
>>
>> org.apache.catalina.loader.StandardClassLoader@d1e604
>>
>> ].
>>
>> log4j:ERROR Could not instantiate appender named "A1".
>>
>> *DEBUG* Scheduling task ManagedService Update:
> pid=org.ops4j.pax.logging
>>
>> *DEBUG* Running task ManagedService Update: pid=org.ops4j.pax.logging
>>
>> 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
>>
>>  repositories:
>>
>> ----------> Parent Classloader:
>>
>> org.apache.catalina.loader.StandardClassLoader@d1e604
>>
>> ].
>>
>> log4j:ERROR Could not instantiate appender named "A8".
>>
>> DEBUG: WIRE: 8.0 -> org.osgi.service.log -> 2.0
>>
>> DEBUG: WIRE: 8.0 -> org.craig.shell.telnet -> 8.0
>>
>> DEBUG: WIRE: 8.0 -> org.apache.felix.shell -> 1.0
>>
>> DEBUG: WIRE: 8.0 -> org.osgi.service.component -> 2.0
>>
>> log4j:WARN No appenders could be found for logger
>> (org.ops4j.pax.logging.pax-log
>>
>> ging-service).
>>
>> log4j:WARN Please initialize the log4j system properly.
>>
>> DEBUG: WIRE: 4.0 -> org.osgi.service.log -> 2.0
>>
>>
>>
>> Any insight would be appreciated... not critical, but I suspect I'm
> not
>> going to see the last of class loader issues, especially in an
> embedded
>> environment...  Thanks, Craig Phillips
>>
>>
>>
>>
>
>
>
> --
> Karl Pauls
> karlpauls@gmail.com
>



-- 
Karl Pauls
karlpauls@gmail.com

Mime
View raw message