If CXF is last in Karaf feature list, endpoints aren't bound
------------------------------------------------------------

                 Key: CXF-4058
                 URL: https://issues.apache.org/jira/browse/CXF-4058
             Project: CXF
          Issue Type: Bug
          Components: OSGi
    Affects Versions: 2.5
         Environment: Talend Service Factory 2.5.0.0 (Karaf 2.2.4, CXF 2.5.0)
            Reporter: Chris Dolan
            Priority: Minor


[I apologize in advance that this bug report has a lot of guesswork in it. I've 
found a workaround so I've marked this as "Minor", but it took me a week to 
find my workaround and I can't figure where the root cause is.]

If I write my "featuresBoot" property in org.apache.karaf.features.cfg like 
this, everything works:

  
featuresBoot=config,ssh,management,activemq-spring,cxf,webconsole,my-custom-feature

But if I (accidentally) move my feature to the front of the list like so:

  
featuresBoot=my-custom-feature,config,ssh,management,activemq-spring,cxf,webconsole

then I get 404's for the resources and "No services have been found." on the 
CXF services list.

My custom feature contains a JAX-RS application which is bootstrapped with a 
META-INF/spring/beans.xml file containing beans roughly like this:

    <jaxrs:server id="admin" address="/path/to/my/application">
        <jaxrs:inInterceptors>
            <ref bean="traceInboundStart"/>
        </jaxrs:inInterceptors>
        <jaxrs:outInterceptors>
            <ref bean="traceOutboundDone"/>
        </jaxrs:outInterceptors>
        <jaxrs:serviceBeans >
            <ref bean="mySvc"/>
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <ref bean="jaxRsAuthFilter"/>
        </jaxrs:providers>
    </jaxrs:server>

Reloading the bundles in "my-custom-feature" fixes the problem (the WADL links 
appear on the services list and the endpoint URLs respond correctly). In both 
scenarios ("my-custom-feature" at the front or back of the featuresBoot list), 
the log messages seem to be nearly identical.

A really confusing part is that in *both* cases, I see this log message which 
seems to suggest success:

[INFO] Setting the server's publish address to be /path/to/my/application
logger = org.apache.cxf.endpoint.ServerImpl
thread = SpringOsgiExtenderThread-2

So, clearly CXF is getting the JAX-RS application successfully, but somehow 
that's not being mapped all the way through to the OSGi HTTP service.

The only other logs that appear relevant appear to be these:

[INFO] SPI-Provider Manifest header found in bundle: org.apache.cxf.bundle
[INFO] Binding bundle: [org.apache.cxf.bundle_2.5.0 [191]] to http service

Those happen just before the "Setting the server's publish address..." message 
but after the Spring "Found mandatory OSGi service for bean..." resolution 
messages in the failing scenario.

I request either 1) a fix so the CXF feature is order independent or 2) a 
troubleshooting log message to indicate that the resources are bound too late 
to help others diagnose this problem more quickly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to