2008/7/7 Sahoo <[EMAIL PROTECTED]>:

> Karl Pauls wrote:
>
>> On Mon, Jul 7, 2008 at 4:08 PM, Sahoo <[EMAIL PROTECTED]> 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
_______________________________________________
general mailing list
general@lists.ops4j.org
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to