This is probably of only academic interest, given the discussion that's gone on so far (i.e. nothng new), but a concrete example from Equinox is using the TCCL to load the correct XML Parser as a service.
The problem-to-solve is described in Bug 285505, and the solution can be seen in http://git.eclipse.org/c/equinox/rt.equinox.framework.git/tree/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/XMLParsingServiceFactory.java#n41 Perhaps some will find this example helpful or interesting? It is, IMO, a classic case of OSGi being able to correctly interact with "legacy code" (Xerces). Perhaps other CXF Services are similar? [And, apologies in advance for stirring up old memories for Tom, who found the whole thing very distasteful :) ] From: Mike Wilson <mike...@hotmail.com> To: "'OSGi Developer Mail List'" <osgi-dev@mail.osgi.org>, Date: 02/24/2015 04:27 AM Subject: Re: [osgi-dev] setting contextClassLoader inside library bundles Sent by: osgi-dev-boun...@mail.osgi.org Thanks Christian, I'll look into posting to cxf-dev then. Without knowing much about CXF internals I do see there is an extension mechanism that adapts for different environments, triggering a Blueprint adaptation in our Karaf installation. My thinking is that CXF could adjust its behaviour to be more OSGi-ish as it is aware it is running under OSGi/Blueprint. Best regards Mike Christian Schneider wrote: This is not completely true. CXF implements the JAX-WS and JAX-RS standards and uses the JAXB implementation. I am not sure about all details (Dan Kulp will probably know best) but the TCCL is needed at some points to enable classloading in a non flat classloader like in OSGi and JEE. So while it may be possible to remove some usage of TCCL in CXF it probably can not be avoided completely. Another issue is that CXF also has to work in JEE environments so we can not just optimize for OSGi. Still it is a good idea to discuss about this maybe on cxf dev. At the very least we will get some insights were the TCCL is needed. I propose to open one or more issues as soon as we have a more concrete idea what can be improved. Christian Am 23.02.2015 um 23:13 schrieb Mike Wilson: Very interesting, this is just the reasoning I was looking for. Then I will conclude that if CXF considers themselves a non-legacy product, then they should redesign so that they do not use or set the TCCL when used in an OSGi setting? (my goal for this discussion thread was to see if it would make sense to submit such a ticket to the CXF project) Best regards Mike -- Christian Schneider http://www.liquid-reality.de Open Source Architect Talend Application Integration Division http://www.talend.com _______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev