Well, as far as I can tell (and I may definitely be missing something) the state of OSGI support in camel-spring is in a pretty sorry state of affair...
camel-spring 2.12.2 depends on spring 3.1.0.RELEASE, but it contains references to the BundleContextAware class which doesn't seem to be supported anymore in spring 3.x. Trying to grab that class from old org.springframework.osgi bundles doesn't help presumably because nobody in spring 3 is paying attention to that interface anymore so the injection of the bundle context doesn't happen. I tried to work around that by declaring my own CamelNamespaceHandler, which registers my own CamelContextFactoryBean which obtains the bundle context by other means. That however eventually fails because the org.apache.camel.core.osgi package is not exported by camel-spring. Looks like the smartest thing to do will be to give up on spring configuration alltogether and create my own Camel context manually. There is a lot valuable code in org.apache.camel.core.osgi and in org.apache.camel.osgi, it is too bad that it is apparently only tested and working on karaf. If someone know what the proper equivalent to BundleContextAware is in spring 3 is I could provide a modified bean factory if that is of interest. Franck -----Original Message----- From: Claus Ibsen [mailto:claus.ib...@gmail.com] Sent: Wednesday, February 12, 2014 3:29 PM To: users@camel.apache.org Subject: Re: Confused with Camel in Spring/OSGI Hi Camel works the best in Apache Karaf as its OSGi container. That is what we use for development and testing. There may be some caveats and issues running in Eclipse Virgo. If it does not matter for you which osgi container, then I suggest to use Apache Karaf On Wed, Feb 12, 2014 at 1:47 PM, franck102 <franckman...@fico.com<mailto:franckman...@fico.com>> wrote: > I am trying to use Camel 2.12. in a Virgo server, using spring/OSGI > since Virgo's blueprint is based on Gemini. > > The context.xml file below sucessfully starts a camel context... > however breaking in the code shows that I am instantiating a > SpringCamelContext rather than a > org.apache.camel.core.osgi.OsgiDefaultCamelContext. > > It looks like I want the org.apache.camel.osgi.CamelContextFactoryBean > to create my camel context, but I just can't figure out how to tell > Spring to use that factory. I have read hundreds of posts about camel, > spring & OSGI and I just can't figure this out, any help would be greatly > appreciated! > > I am using maven and having dependencies on camel-core and camel-spring. > It looks like osgi support has been embedded into camel-spring, and so > I should not need or want dependencies on camel-core-osgi or camel-osgi? > > > <?xml version="1.0" encoding="UTF-8"?> > > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-3.0.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd"> > > <camelContext id="ModelCentralCamelContext" > xmlns="http://camel.apache.org/schema/spring"> > <endpoint id="mcedits" > uri="seda:mcedits?multipleConsumers=true"/> > > <route> > <from ref="mcedits"/> > <to uri="log:ExampleRouter"/> > </route> > <route> > <from ref="mcedits"/> > <to uri="file:${mcentral-distrib}/eai/mcedits"/> > </route> > </camelContext> > > <bean class="com.fico.modelcentral.eai.context.MCEditProducer"/> > </beans> > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Confused-with-Camel-in-Spring-OSGI-t > p5747186.html Sent from the Camel - Users mailing list archive at > Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: cib...@redhat.com<mailto:cib...@redhat.com> Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen Make your Camel applications look hawt, try: http://hawt.io This email and any files transmitted with it are confidential, proprietary and intended solely for the individual or entity to whom they are addressed. If you have received this email in error please delete it immediately.