Hi everyone,

I am having some problems with CXF HTTP Transport in an OSGi environment using 
Apache Felix as OSGi Framwork.

I'm using the Felix Http Bridge to start Felix within a .war web application 
which runs in Tomcat. The problem is, that the ServiceTracker which is set up 
in org.apache.cxf.transport.http.osgi.HTTPTransportActivator does not find the 
HttpService which is provided by the bundle org.apache.felix.http.bridge.

I tried a small change in the CXF code, changing line 64 in 
HTTPTransportActivator to

httpServiceTracker.open(true);

With this change the HttpService is recognized by the ServiceTracker and the 
CXF Servlet is setup correctly.

I did a bit more debugging to get to the root cause of this behavior and found, 
that the problem is caused when the method

ServiceRegistrationImpl.isAssignableTo() 

is called in the process of opening the ServiceTracker and getting the list of 
already available services for the interface HttpService (ServiceTracker. 
getInitialReferences() -> context.getServiceReferences). The Implementation of 
Felix' HttpService 
(org.apache.felix.http.base.internal.service.HttpServiceImpl) implements not 
only HttpService but also ExtHttpService. And when asking 
ServiceRegistrationImpl.isAssignableTo() with the parameters requester: 
"org.apache.cxf.cxf-rt-transports-http [27]" and className: 
"org.apache.felix.http.api.ExtHttpService" it returns false.

Now a simple fix is given by what I already wrote above: Changing 
httpServiceTracker.open() to httpServiceTracker.open(true); in 
HTTPTransportActivator

So I'd like to ask two questions:
1. Does anyone have a better solution on how to get this scenario working?
2. If not: Could this fix be inserted into the CXF code to enable us (and 
others which might have similar problems) to use the offical .jar and not a 
self-built one?

Thanks for your comments,
Thomas

Reply via email to