9 Replies Latest reply on Sep 16, 2011 9:16 AM by jamie archibald

    Camel components + osgi + spring

    jamie archibald Apprentice

      I have a spring file in "META-INF/spring" with a simple route as follows:

       

       

       

      Edited by: jamie3 on Sep 14, 2011 7:29 PM

        • 1. Re: Camel components + osgi + spring
          Freeman(Yue) Fang Master

          Hi,

           

          You need install camel-jetty feature

           

          features:install camel-jetty

           

          Freeman

          • 2. Re: Camel components + osgi + spring
            Willem Jiang Master

            Maven dependency management cannot help your bundle when you install your bundle into OSGi.

            You can leverage the feature that is provide in FUSE ESB to manage the third part bundle dependency. For you case, as Freeman has mentioned you just need to make sure the camel-jetty feature is installed.

             

            Willem

            • 3. Re: Camel components + osgi + spring
              jamie archibald Apprentice

              Sorry I should have mentioned previously that camel-jetty 2.8.0 is installed. I am still getting the same exception.

               

              I noticed the camel-jetty feature on FuseESB also had version 2.7.1-fuse-00-43, so I changed my maven pom to use this version and still getting the exception.

               

              Edited by: jamie3 on Sep 15, 2011 11:10 AM

               

              Edited by: jamie3 on Sep 15, 2011 11:12 AM

              • 4. Re: Camel components + osgi + spring
                jamie archibald Apprentice

                I attempted to go back to the basics and follow the service mix guide for camel

                 

                http://servicemix.apache.org/docs/4.3.0-SNAPSHOT/users-guide/camel/camel-guide.pdf

                 

                Exception in thread "SpringOsgiExtenderThread-63" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camelContext': Invocation of init method failed; nested exception is org.apache.camel.CamelException: Cannot find any routes with this RouteBuilder reference: RouteBuilderRef[imageRoute]

                • 5. Re: Camel components + osgi + spring
                  Ioannis Canellos Newbie

                  Could you please provide the full stack trace from your logs?

                  • 6. Re: Camel components + osgi + spring
                    jamie archibald Apprentice

                    here is the output from karaf.

                     

                    karaf@root> Exception in thread "SpringOsgiExtenderThread-153" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camel-166

                    ': Invocation of init method failed; nested exception is org.apache.camel.CamelException: Cannot find any routes with this RouteBuilder reference: RouteBuilderR

                    ef[myapp]

                            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)

                            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

                            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

                            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)

                            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

                            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)

                            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)

                            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:281)

                            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)

                            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)

                            at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)

                            at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:6

                    9)

                            at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)

                            at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

                            at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.ja

                    va:320)

                            at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterAp

                    plicationContextExecutor.java:132)

                            at java.lang.Thread.run(Thread.java:662)

                    Caused by: org.apache.camel.CamelException: Cannot find any routes with this RouteBuilder reference: RouteBuilderRef[test]

                            at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.installRoutes(AbstractCamelContextFactoryBean.java:585)

                            at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.afterPropertiesSet(AbstractCamelContextFactoryBean.java:303)

                            at org.apache.camel.osgi.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:66)

                            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)

                            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)

                            ... 16 more

                    • 7. Re: Camel components + osgi + spring
                      jamie archibald Apprentice

                      here is the output from the karaf web console

                       

                       

                      Fri Sep 16 2011 07:49:12 GMT-0300 (Atlantic Daylight Time)     ERROR     Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=example-osgi, config=osgibundle:/META-INF/spring/*.xml))          org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camel-166': Invocation of init method failed; nested exception is org.apache.camel.CamelException: Cannot find any routes with this RouteBuilder reference: RouteBuilderRef[myapp]

                       

                       

                      Fri Sep 16 2011 07:49:12 GMT-0300 (Atlantic Daylight Time)     INFO     Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@70688f5d: defining beans ; root of factory hierarchy          

                       

                       

                      Fri Sep 16 2011 07:49:12 GMT-0300 (Atlantic Daylight Time)     INFO     Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@70688f5d: defining beans ; root of factory hierarchy          

                       

                       

                      Fri Sep 16 2011 07:49:12 GMT-0300 (Atlantic Daylight Time)     INFO     No outstanding OSGi service dependencies, completing initialization for OsgiBundleXmlApplicationContext(bundle=example-osgi, config=osgibundle:/META-INF/spring/*.xml)          

                       

                       

                      Fri Sep 16 2011 07:49:12 GMT-0300 (Atlantic Daylight Time)     DEBUG     BundleEvent STARTED

                      • 8. Re: Camel components + osgi + spring
                        Claus Ibsen Master

                        Can you post the XML file that contains your  ?

                        • 9. Re: Camel components + osgi + spring
                          jamie archibald Apprentice

                          Looks like I was able to fix it.

                          Something was messed up with ServiceMix 4.4 default features during startup.

                           

                          So I removed all the features and included only the following:

                           

                          featuresBoot=karaf-framework,config,activemq-broker,camel,camel-activemq,camel-nmr,camel-cxf,camel-jms

                           

                          Afterwards I no longer received the missing bean exception.