1 2 Previous Next 20 Replies Latest reply on Oct 15, 2012 11:47 AM by wbailey

    Camel Route Startup Issues...

    jwcarman

      I'm using Fabric to deploy our code.  We have various camel-based bundles that we deploy.  None of them are starting up in my container (stopping/restarting each bundle works just fine).  I keep getting this exception:

       

      org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to intialize bean .camelBlueprint.factory.esb-routes

              at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:640)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:726)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:198)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:137)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:709)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelDependenciesFinder.process(CamelNamespaceHandler.java:648)[95:org.apache.camel.camel-blueprint:2.9.0.fuse-7-061]

              at org.apache.aries.blueprint.container.BlueprintContainerImpl.processProcessors(BlueprintContainerImpl.java:486)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:320)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:232)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.apache.aries.blueprint.container.BlueprintExtender.checkBundle(BlueprintExtender.java:325)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.apache.aries.blueprint.container.BlueprintExtender.bundleChanged(BlueprintExtender.java:244)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.apache.aries.blueprint.container.BlueprintExtender$BlueprintBundleTrackerCustomizer.modifiedBundle(BlueprintExtender.java:471)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:495)[karaf.jar:2.2.5.fuse-7-061]

              at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:1)[karaf.jar:2.2.5.fuse-7-061]

              at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:238)[karaf.jar:2.2.5.fuse-7-061]

              at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:457)[karaf.jar:2.2.5.fuse-7-061]

              at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:870)[org.apache.felix.framework-4.0.3.fuse-7-061.jar:]

              at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:791)[org.apache.felix.framework-4.0.3.fuse-7-061.jar:]

              at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:515)[org.apache.felix.framework-4.0.3.fuse-7-061.jar:]

              at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4321)[org.apache.felix.framework-4.0.3.fuse-7-061.jar:]

              at org.apache.felix.framework.Felix.startBundle(Felix.java:1945)[org.apache.felix.framework-4.0.3.fuse-7-061.jar:]

              at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1213)[org.apache.felix.framework-4.0.3.fuse-7-061.jar:]

              at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)[org.apache.felix.framework-4.0.3.fuse-7-061.jar:]

              at java.lang.Thread.run(Thread.java:662)[:1.6.0_32]

      Caused by: java.lang.NullPointerException

              at org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:331)

              at org.apache.camel.blueprint.CamelContextFactoryBean.initPropertyPlaceholder(CamelContextFactoryBean.java:213)

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

              at org.apache.camel.blueprint.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:268)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_32]

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_32]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_32]

              at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_32]

              at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:225)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:838)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:638)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

              ... 25 more

       

      Edited by: jwcarman on Oct 10, 2012 6:40 PM

       

      Edited by: jwcarman on Oct 10, 2012 6:42 PM

        • 1. Re: Camel Route Startup Issues...
          jasonnh

          I think this may be the same issue I have:

           

          http://fusesource.com/forums/thread.jspa?messageID=15141&#15141

           

          Sorry but I have not got a solution

          • 2. Re: Camel Route Startup Issues...
            wbailey

            I've seen that issue too, to resolve it I have to manually connect to the child container and refresh the broken bundle.

             

            We get the same exception:

             

            org.apache.aries.blueprint - 0.3.1.fuse-7-061 | Unable to start blueprint container for bundle com.test.test-simulator

            org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to intialize bean .camelBlueprint.factory.blueprintContext

                 at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:640)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:726)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:198)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:137)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:709)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelDependenciesFinder.process(CamelNamespaceHandler.java:648)[99:org.apache.camel.camel-blueprint:2.9.0.fuse-7-061]

                 at org.apache.aries.blueprint.container.BlueprintContainerImpl.processProcessors(BlueprintContainerImpl.java:486)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:320)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:232)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.apache.aries.blueprint.container.BlueprintExtender.checkBundle(BlueprintExtender.java:325)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.apache.aries.blueprint.container.BlueprintExtender.bundleChanged(BlueprintExtender.java:244)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.apache.aries.blueprint.container.BlueprintExtender$BlueprintBundleTrackerCustomizer.modifiedBundle(BlueprintExtender.java:471)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:495)[karaf.jar:2.2.5.fuse-7-061]

                 at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:1)[karaf.jar:2.2.5.fuse-7-061]

                 at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:238)[karaf.jar:2.2.5.fuse-7-061]

                 at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:457)[karaf.jar:2.2.5.fuse-7-061]

                 at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:870)[org.apache.felix.framework-4.0.3.fuse-7-061.jar:]

                 at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:791)[org.apache.felix.framework-4.0.3.fuse-7-061.jar:]

                 at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:515)[org.apache.felix.framework-4.0.3.fuse-7-061.jar:]

                 at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4321)[org.apache.felix.framework-4.0.3.fuse-7-061.jar:]

                 at org.apache.felix.framework.Felix.startBundle(Felix.java:1945)[org.apache.felix.framework-4.0.3.fuse-7-061.jar:]

                 at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:947)[org.apache.felix.framework-4.0.3.fuse-7-061.jar:]

                 at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:934)[org.apache.felix.framework-4.0.3.fuse-7-061.jar:]

                 at org.fusesource.fabric.agent.DeploymentAgent.updateDeployment(DeploymentAgent.java:686)[63:org.fusesource.fabric.fabric-agent:7.0.0.fuse-061]

                 at org.fusesource.fabric.agent.DeploymentAgent.doUpdate(DeploymentAgent.java:371)[63:org.fusesource.fabric.fabric-agent:7.0.0.fuse-061]

                 at org.fusesource.fabric.agent.DeploymentAgent$1.run(DeploymentAgent.java:204)[63:org.fusesource.fabric.fabric-agent:7.0.0.fuse-061]

                 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_19]

                 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_19]

                 at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_19]

                 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_19]

                 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_19]

                 at java.lang.Thread.run(Thread.java:619)[:1.6.0_19]

            Caused by: java.lang.NullPointerException

                 at org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:331)

                 at org.apache.camel.blueprint.CamelContextFactoryBean.initPropertyPlaceholder(CamelContextFactoryBean.java:213)

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

                 at org.apache.camel.blueprint.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:268)

                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_19]

                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_19]

                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_19]

                 at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_19]

                 at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:225)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:838)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:638)[8:org.apache.aries.blueprint:0.3.1.fuse-7-061]

                 ... 33 more

             

            I'm convinced it's a dependency problem, Fabric doesn't seem to work out the dependency order correctly.

             

            Edited by: warrenbailey on Oct 11, 2012 8:30 AM

            • 3. Re: Camel Route Startup Issues...
              jwcarman

              I agree that it looks like a dependency problem.  The funny thing is that it would seem to me that the camel-blueprint feature should depend upon camel-core which contains the camel activator that should fix this problem once it fires.  The camel-blueprint bundle would be required by our bundle, since it contains the blueprint NamespaceHandler, so that should be enough to make our bundles hold off until camel-core is finished initializing.  This may be a race condition?  Do the activators fire in a different thread than the blueprint container creation?  I don't know, but I'm at a loss here about what to do.  We're trying to migrate to Fuse Enterprise ESB and this is standing in the way.

              • 4. Re: Camel Route Startup Issues...
                stlewis

                Best way to achieve what you're looking for is to set up a feature repository for your bundle and explicitly list camel-core, camel-blueprint and other dependent features first (and add dependency="true").  Otherwise the provisioning agent has no idea that it needs to deploy camel-blueprint first and wait for it to initialize before it deploys your bundle, unless you've explicitly put Require-Bundle for camel-blueprint etc. in your bundles manifest I suppose.  Setting up a feature definition is really the way to go though, there's an example one for the fabric camel example here, okay so it doesn't have the "dependency=true" bit, but does deploy fine via fabric.

                 

                I think a common problem folks run into is that "bundles" that are set up in a fabric profile aren't necessarily deployed after the same "features" that are defined in the same profile.  I'll log an improvement to see if we can do something here, as it'd be more intuitive I think, especially when using the management console if features were provisioned first and then bundles.

                • 5. Re: Camel Route Startup Issues...
                  stlewis

                  Created FABRIC-284 for that improvement I mentioned, hopefully we can get that in...

                  • 6. Re: Camel Route Startup Issues...
                    iocanel

                    I think that this issue has been already addressed in 7.0.1 or in the forthcoming 7.0.2.

                     

                    What version are you using?

                    • 7. Re: Camel Route Startup Issues...
                      wbailey

                      I'm having problems with it in 7.0.1 and 7.0.2. In those versions I don't get the null pointer exception, instead the bundles get stuck in Grace Period.

                       

                      I'm also struggling to understand where I should be putting the ' dependency="true" ' flag? Is that on the feature element I'm dependent on? or on the bundle that needs the dependency?

                      • 8. Re: Camel Route Startup Issues...
                        stlewis

                        It goes on the feature element your bundle(s) depend on.

                         

                        Also, I've found it's worth testing it out in a standalone instance of Fuse ESB to ensure everything is working smoothly before trying to deploy it via fabric.

                        • 9. Re: Camel Route Startup Issues...
                          wbailey

                          Thanks, I'll give that a go

                          • 10. Re: Camel Route Startup Issues...
                            wbailey

                            It isn't working for me, I've added all the dependent features and put dependency=true on them as follows:

                             

                            <feature name="smpp-simulator-feature" version="1.0-SNAPSHOT">
                                 <feature dependency="true">war</feature>
                                 <feature dependency="true">activemq</feature>
                                 <feature dependency="true">camel-activemq</feature>
                                 <feature dependency="true">jetty</feature>
                                 <feature dependency="true">camel</feature>
                                 <feature dependency="true">camel-jetty</feature>
                                 <feature dependency="true">camel-core</feature>
                                 <feature dependency="true">camel-blueprint</feature>
                                 <feature dependency="true">camel-smpp</feature>
                                 <bundle>mvn:com.test.sms/smpp-simulator/1.0-SNAPSHOT</bundle>
                                 <bundle>mvn:com.test.sms/smpp-simulator-web/1.0-SNAPSHOT/war</bundle>
                            </feature>
                            

                             

                            However the Jetty components are deployed after my SMPP simulator bundle and this causes it to go into GracePeriod:

                             

                            [ 100] [Active     ] [GracePeriod ] [       ] [   60] SMPP Simulator (1.0.0.SNAPSHOT
                            

                             

                            btw, it works when it isn't deployed as a fabric profile.

                             

                            Edited by: warrenbailey on Oct 15, 2012 2:09 PM

                            • 11. Re: Camel Route Startup Issues...
                              stlewis

                              Try adding:

                               

                              resolver="(obr)"

                               

                              to the outer feature element of your feature.  I found I needed that for my own examples to deploy properly.

                               

                              You might also be able to simplify your list of dependent features a bit, for example camel-activemq already installs the activemq feature, camel-jetty and war both install the jetty feature.  Also is "camel" a feature?  Think you should be all set with camel-core and camel-blueprint.  So for example I'd recommend defining them like:

                               

                              camel-core

                              camel-blueprint

                              camel-activemq

                              camel-jetty

                              camel-smpp

                               

                              With camel-jetty listed before camel-blueprint and camel-core it'll have to wait for those features to be installed first before it can be started.  Hope that all helps!

                              • 12. Re: Camel Route Startup Issues...
                                wbailey

                                To be honest, I kept throwing features in trying to get it to work. Originally I only had the camel ones in there. I've changed it so it matches your suggestion:

                                 

                                <feature name="smpp-simulator-feature" version="1.0-SNAPSHOT" resolver="(obr)">
                                     <feature dependency="true">camel-core</feature>
                                     <feature dependency="true">camel-blueprint</feature>
                                     <feature dependency="true">camel-activemq</feature>
                                     <feature dependency="true">camel-jetty</feature>
                                     <feature dependency="true">camel-smpp</feature>
                                     <bundle>mvn:com.test.sms/smpp-simulator/1.0-SNAPSHOT</bundle>
                                     <bundle>mvn:com.test.sms/smpp-simulator-web/1.0-SNAPSHOT/war</bundle>
                                </feature>
                                

                                 

                                Unfortunately though, it still didn't work. I tried 7.0.0, 7.0.1 and 7.0.2. It seems like fabric is ignoring the dependency= true bit.

                                • 13. Re: Camel Route Startup Issues...
                                  iocanel

                                  Could you please search or attach the logs, so that we can identify why the bundle stucks in grace period? You should be able to find a log entry that indicates that the bundle is waiting for a service.

                                  • 14. Re: Camel Route Startup Issues...
                                    wbailey

                                    The only entry in the logs that refers to a service waiting is this one:

                                     

                                    15:53:23,396 | INFO  | use-084-thread-1 | BlueprintContainerImpl           | 11 - org.apache.aries.blueprint - 0.3.1.fuse-70-084 | Bundle org.fusesource.patch.patch-commands is waiting for dependencies

                                    1 2 Previous Next