Hi Franck, Thanks for sharing these with us. This key to let Camel run with OSGi is inject the BundleContext rightly. Do you mind creating a simple patch with the test case to verify it? I’d be happy to review it and merge it to the master branch.
-- 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 February 17, 2014 at 1:58:54 AM, Mangin, Franck (franckman...@fico.com) wrote: > > For anyone going through this thread in the future, Virgo is an > evolution of Spring DM. The BundleAware interface that camel-spring > is relying on has been moved into a different package in the embedded > Virgo version of Spring DM (somewhere under a blueprint package). > > The right approach then (which I have not tested) would be to create > a modified OsgiDefaultCamelContext that leverages that Virgo-specific > BundleAware interface. The OSGI detection in CamelNamespaceHandler > will have to be fixed accordingly > (Class.forName("org.apache.camel.osgi.CamelContextFactoryBean"); > will fail). > > Franck > > -----Original Message----- > From: Mangin, Franck [mailto:franckman...@fico.com] > Sent: Thursday, February 13, 2014 6:55 AM > To: users@camel.apache.org > Subject: RE: Confused with Camel in Spring/OSGI > > Thanks Willem, that clarifies things, I hadn't fully realized > that Spring DM is clearly distinct from spring. > > > > I am a bit hesitant about bringing in Spring DM into the picture > for a couple reasons: > > - Virgo comes with spring 3 installed (and uses it heavily), the > latest version of spring DM onMaven Central depends on spring > 2.5.6 > > - I am a bit concerned with spring DM / OSGI interactions messing > up internal Virgo spring wirings > > > > I gave blueprint a try but Virgo ships with Gemini whereas the > Camel blueprint support has hard dependencies on Apache Aries... > > > > I think I can get the org.apache.camel.core.osgi.OsgiDefaultCamelContext > up and running: will that actually be useful without Spring DM > installed? Or is pretty much all the OSGI support in camel-spring > dependent on spring DM being deployed? > > One example of what I would hope to achieve is to be able to register > / detect TypeConverters through OSGI mechanisms (classloaders > and/or registry)? > > > > Thanks! > > Franck > > > > -----Original Message----- > From: Willem Jiang [mailto:willem.ji...@gmail.com] > Sent: Thursday, February 13, 2014 2:44 AM > To: users@camel.apache.org > Subject: RE: Confused with Camel in Spring/OSGI > > > > Hi, > > > > Current camel-spring are only tested with Spring-DM, camel-blueprint > could be an option for you if the Virgo server support the Blueprint > out of box, but you may not use the some advance features that spring > provides. > > > > > > -- > > 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 February 13, 2014 at 1:35:55 AM, Mangin, Franck (franckman...@fico.com) > wrote: > > > > > > 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 > > > > 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? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > 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"> > > > > > > > > > > > > > > > > > > > xmlns="http://camel.apache.org/schema/spring"> > > > > > > > > > > > > uri="seda:mcedits?multipleConsumers=true"/> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > 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 > > > > > > 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. > > > > > > > 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. > > 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. >