As the cxfbeanReference wasn’t used by Camel as an OSGi service, so you setting cannot block the loading of the CamelContext. How about adding the Required-Bundle of camel-cxf in your application bundle?
-- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Thursday, October 31, 2013 at 5:44 AM, Calvert, Zach (Zach)** CTR ** wrote: > This is somewhat of a cross post between here and the ApacheServiceMix > mailing list, but I'm thinking I should have fired this email to camel in the > first place. I apologize for the cross post in advance. > > I'm making use of the cxfbean component in Apache ServiceMix 4.5.3. I have > reviewed the source and OSGI services being exposed here to try to get around > the race condition I am experiencing, but while the service is up and > running, ServiceMix/Camel does not yet recognize the component and I'm not > sure who to direct this question/problem to. > > Breakdown: > I have a bundle which has the following route: > > <camel:route> > <camel:from uri="jetty: > http://0.0.0.0:9089/health/?matchOnUriPrefix=true" /> > <camel:to uri="cxfbean:healthService" /> > </camel:route> > > The health service implementation is a standard javax.ws.rs annotated class. > The cxfbean component is exposed in the camel-cxf feature under the > camel-cxf-2.10.7 bundle (I have confirmed). To try to enforce that the > cxfbean service really, really is running, I have added > <osgi:reference id="cxfbeanReference" cardinality="1..1" > interface="org.apache.camel.spi.ComponentResolver" > filter="(component=cxfbean)" /> > to my bundle. This osgi reference is met and fully populated, however I still > get > "---- > Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create > route route1 at: >>> To[cxfbean:healthService] <<< in route: > Route[[From[jetty:http://0.0.0.0:9089... because of Failed to resolve > endpoint: cxfbean://healthService due to: No component found with scheme: > cxfbean > ---" > in my ServiceMix startup. Note that this bundle is deployed in the > apache-servicemix-4.5.3/deploy directory on a Linux machine. > > This issue can be resolved simply by waiting for ServiceMix to be started > for a few minutes and then run > touch > ./apache-servicemix-4.5.3/deploy/ecs.bundles.health-2.3.0.25-SNAPSHOT.jar > > I would like to have the bundle block until the "cxfbean" component is fully > started. Again this is a race condition and functionality is fully restored > by waiting a couple of minutes and then running touch on the bundle that > exposes this camel route. > > Is there a way to say "Really wait on starting this bundle until the cxfbean > component is fully started and ready to go"? > > > Thank you, > Zach Calvert