Skip to content

CXF bus extension not working as expected in OSGI #577

Open
@amergey

Description

@amergey

Not sure it is an issue you are supposed to fix, but I think it is interesting to raise here just in case

In CXF 4.x, osgi and blueprint integration is removed. To workaround that I am using camel-cxf-all and camel-cxf-blueprint, waiting for CXF to restore it somehow.

I faced an issue caused by the fact that all CXF bundle were merged in one bundle.
org.apache.camel.component.cxf.bus.osgi.CXFActivator#start is registering org.apache.camel.component.cxf.bus.osgi.CXFExtensionBundleListener, which is supposed to populate CXF ExtensionRegisty with OSGI wrapper arround CXF extension provided by various CXF bundles.

I do not really understand why it was like this in CXF, but the code registering extensions (org.apache.camel.component.cxf.bus.osgi.CXFExtensionBundleListener#registerExistingBundles) is excluding the current bundle (In original code base it was cxf-core), and as all bundles have been merged in one, no more osgi wrappers around Extension are registered anymore.

In my application it breaks CXF configuration with blueprint for JAXRS service
<jaxrs:server id="customerService" address="/customers"> <jaxrs:serviceBeans> <ref component-id="serviceBean" /> </jaxrs:serviceBeans> </jaxrs:server>

The org.apache.cxf.transport.servlet.CXFNonSpringServlet registered in my osgi container is not able to route http://host/cxf/customers queries to the service, because it is not retrieving the correct org.apache.cxf.transport.http.HTTPTransportFactory OSGI service which contains all services configured trough blueprint.

My workaround, was to call org.apache.camel.component.cxf.bus.osgi.CXFExtensionBundleListener#registerExistingBundles from another bundle, but
one way to fix that could be to update org.apache.camel.component.cxf.bus.osgi.CXFExtensionBundleListener#registerExistingBundles to remove
this from the if
&& bundle.getBundleId() != context.getBundle().getBundleId()

My guess is there are probably multiple stuff broken in OSGI, because of this

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions