You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Kelvin Chan <ke...@positronics.com> on 2011/02/15 03:18:51 UTC

class loading issue with log4j

Hi guys,

I'm using Felix 3.0.0 with sprintsource's log4j bundle (1.2.16)
(http://goo.gl/98qYW)

when my code starts up, log4j complains about ConsoleAppender was not
loaded by the same loader with  Appender. Felix loads the log4j bundle
properly cuz felix debug outputs:

DEBUG: WIRE: [5.0] package; (package=org.apache.log4j) -> [1.0]
DEBUG: log4j.xml
DEBUG: log4j.properties

here's the console output from log4j.

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 [1.0] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by
[sun.misc.Launcher$AppClassLoader@64601bb1].
log4j:ERROR Could not instantiate appender named "stdout".
log4j:WARN No appenders could be found for logger
(com.positronics.pumpkin.engine.Activator).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig
for more info.

this is my manifest:
Manifest-Version: 1.0
Bundle-Name: Engine Interface
Bundle-Description: Engine
Bundle-Activator: engine.Activator
Import-Bundle: com.springsource.org.apache.log4j;version="[1.2.16,1.2.16]"
Import-Package: org.osgi.framework,org.apache.log4j

Any ideas?

Thanks,

kelvin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: class loading issue with log4j

Posted by Kelvin Chan <ke...@positronics.com>.
Subtle clues in the error message. Great catch Richard.
Thanks.

On Tue, Feb 15, 2011 at 10:02 AM, Richard S. Hall <he...@ungoverned.org> wrote:
>
> How are you launching the OSGi framework? Do you have log4j on the application class path too? If so, remove it.
>
> -> richard
>
> On 2/14/11 21:18, Kelvin Chan wrote:
>>
>> Hi guys,
>>
>> I'm using Felix 3.0.0 with sprintsource's log4j bundle (1.2.16)
>> (http://goo.gl/98qYW)
>>
>> when my code starts up, log4j complains about ConsoleAppender was not
>> loaded by the same loader with  Appender. Felix loads the log4j bundle
>> properly cuz felix debug outputs:
>>
>> DEBUG: WIRE: [5.0] package; (package=org.apache.log4j) ->  [1.0]
>> DEBUG: log4j.xml
>> DEBUG: log4j.properties
>>
>> here's the console output from log4j.
>>
>> 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 [1.0] whereas object of type
>> log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by
>> [sun.misc.Launcher$AppClassLoader@64601bb1].
>> log4j:ERROR Could not instantiate appender named "stdout".
>> log4j:WARN No appenders could be found for logger
>> (com.positronics.pumpkin.engine.Activator).
>> log4j:WARN Please initialize the log4j system properly.
>> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig
>> for more info.
>>
>> this is my manifest:
>> Manifest-Version: 1.0
>> Bundle-Name: Engine Interface
>> Bundle-Description: Engine
>> Bundle-Activator: engine.Activator
>> Import-Bundle: com.springsource.org.apache.log4j;version="[1.2.16,1.2.16]"
>> Import-Package: org.osgi.framework,org.apache.log4j
>>
>> Any ideas?
>>
>> Thanks,
>>
>> kelvin
>>
>> ---------------------------------------------------------------------
>> 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
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: class loading issue with log4j

Posted by "Richard S. Hall" <he...@ungoverned.org>.
How are you launching the OSGi framework? Do you have log4j on the 
application class path too? If so, remove it.

-> richard

On 2/14/11 21:18, Kelvin Chan wrote:
> Hi guys,
>
> I'm using Felix 3.0.0 with sprintsource's log4j bundle (1.2.16)
> (http://goo.gl/98qYW)
>
> when my code starts up, log4j complains about ConsoleAppender was not
> loaded by the same loader with  Appender. Felix loads the log4j bundle
> properly cuz felix debug outputs:
>
> DEBUG: WIRE: [5.0] package; (package=org.apache.log4j) ->  [1.0]
> DEBUG: log4j.xml
> DEBUG: log4j.properties
>
> here's the console output from log4j.
>
> 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 [1.0] whereas object of type
> log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by
> [sun.misc.Launcher$AppClassLoader@64601bb1].
> log4j:ERROR Could not instantiate appender named "stdout".
> log4j:WARN No appenders could be found for logger
> (com.positronics.pumpkin.engine.Activator).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig
> for more info.
>
> this is my manifest:
> Manifest-Version: 1.0
> Bundle-Name: Engine Interface
> Bundle-Description: Engine
> Bundle-Activator: engine.Activator
> Import-Bundle: com.springsource.org.apache.log4j;version="[1.2.16,1.2.16]"
> Import-Package: org.osgi.framework,org.apache.log4j
>
> Any ideas?
>
> Thanks,
>
> kelvin
>
> ---------------------------------------------------------------------
> 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