cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <>
Subject Re: avoid using contextClassLoader inside OSGi?
Date Tue, 24 Feb 2015 17:05:13 GMT

On 24/02/15 14:46, Mike Wilson wrote:
> Yes, the undesired side-effect for us is that the combination of CXF, Juli
> and Pax Logging breaks down. Looking at the code it seems all involved
> parties have design decisions done with good intentions and the only
> questionable thing is CXF's use of TCCL, which is sort of the trigger of the
> problem. So I thought this would be the first thing worth considering as it
> is advised against in OSGi.
> If not possible to remove TCCL entirely, then it might still be possible to
> only set it during the very calls into stuff that need it, instead of during
> the whole message cycle?

Can you please describe in more details where setting TCCL in CXF causes 
issues with this particular combination ? Or is the problem across CXF ? 
I guess a single example would do for us to see if it is.

Are you referring to

public ChainInitiationObserver(Endpoint endpoint, Bus bus) {
         this.endpoint = endpoint;
         this.bus = bus;
         if (bus != null) {
             loader = bus.getExtension(ClassLoader.class);

and then this loader, if not null, is set as TCCL ?

I've just tun a non OSGI test, it is null...

Cheers, Sergey

> Best regards
> Mike
> Sergey Beryozkin wrote:
>> Are you dealing with some specific side-effects or would just like to
>> see less of TCCL in CXF ?
>> I agree with what Christian said - in some cases CXF needs it
>> as it is
>> not an OSGI-only framework. But if minimizing the use of TCCL is
>> possible then I guess it is a good idea.
>> Sergey
>> On 24/02/15 09:44, Mike Wilson wrote:
>>> We're using CXF in a Karaf/OSGi setting and have noticed
>> that CXF makes use
>>> of the contextClassLoader (TCCL), which is considered bad
>> practice in OSGi.
>>> Some discussion has taken place on the osgi-dev mailing
>> list, see [1], and
>>> Christian Schneider recommended to take this question to cxf-dev.
>>> Would it be possible to disable, or decrease the scope of,
>> TCCL usage in CXF
>>> when run inside OSGi?
>>> Looking at the source code I see CXF is already aware that
>> it is running
>>> inside OSGi through its Blueprint integration, so I'm
>> thinking maybe this
>>> would be possible to control through the extension mechanism?
>>> Thanks
>>> Mike Wilson
>>> [1]

View raw message