Uploaded image for project: 'Fabric8'
  1. Fabric8
  2. FABRIC-19

Camel route cannot retrieve the id of the org.linkedin.zookeeper.client.IZKClient' when the route is started

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 1.1-old
    • Component/s: camel
    • Labels:
      None

      Description

      1) Camel Route

      <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
                 xsi:schemaLocation="
                 http://www.osgi.org/xmlns/blueprint/v1.0.0
                 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
       
          <!-- osgi blueprint property placeholder -->
          <cm:property-placeholder id="placeholder" persistent-id="fabricCamel">
              <cm:default-properties>
                  <cm:property name="portNumber" value="8181"/>
              </cm:default-properties>
          </cm:property-placeholder>
       
          <camelContext id="camel" trace="false" xmlns="http://camel.apache.org/schema/blueprint">
              <!--
              <propertyPlaceholder id="properties" location="ref:fabricCamel"/>
              -->
              <route id="fabric-server">
                  <from uri="fabric:cheese:jetty:http://0.0.0.0:{{portNumber}}/fabric"/>
                  <log message="Request received : ${body}"/>
                  <setHeader headerName="karaf.name">
                      <simple>${sys.karaf.name}</simple>
                  </setHeader>
                  <transform>
                      <simple>Response from Zookeeper agent</simple>
                  </transform>
              </route>
          </camelContext>
       
      </blueprint>

      2) Error

      11:56:53,520 | ERROR | rint Extender: 3 | BlueprintContainerImpl           | container.BlueprintContainerImpl  358 | 9 - org.apache.aries.blueprint - 0.3.1 | Unable to start blueprint container for bundle camel-server
      org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to intialize bean camel
      	at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:638)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:724)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:198)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:137)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:718)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelDependenciesFinder.process(CamelNamespaceHandler.java:499)[63:org.apache.camel.camel-blueprint:2.7.0]
      	at org.apache.aries.blueprint.container.BlueprintContainerImpl.processProcessors(BlueprintContainerImpl.java:495)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:314)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:227)[9:org.apache.aries.blueprint:0.3.1]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_24]
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_24]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_24]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)[:1.6.0_24]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)[:1.6.0_24]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_24]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_24]
      	at java.lang.Thread.run(Thread.java:680)[:1.6.0_24]
      Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route fabric-server: Route[[From[fabric:cheese:jetty:http://0.0.0.0:{{portNumber}... because of Failed to resolve endpoint: fabric://cheese:jetty:http://0.0.0.0:9191/fabric due to: Cannot auto create component: fabric
      	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:170)
      	at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:706)
      	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1643)
      	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1432)
      	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1336)
      	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
      	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
      	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1314)
      	at org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:78)
      	at org.apache.camel.blueprint.BlueprintCamelContext.init(BlueprintCamelContext.java:73)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_24]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_24]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_24]
      	at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_24]
      	at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:226)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:824)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:636)[9:org.apache.aries.blueprint:0.3.1]
      	... 18 more
      Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: fabric://cheese:jetty:http://0.0.0.0:9191/fabric due to: Cannot auto create component: fabric
      	at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:450)
      	at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:47)
      	at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:180)
      	at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:110)
      	at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:116)
      	at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
      	at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:88)
      	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:793)
      	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:165)
      	... 34 more
      Caused by: org.apache.camel.RuntimeCamelException: Cannot auto create component: fabric
      	at org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:297)
      	at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:427)
      	... 42 more
      Caused by: org.apache.camel.RuntimeCamelException: org.osgi.service.blueprint.container.NoSuchComponentException: No component with id 'org.linkedin.zookeeper.client.IZKClient' could be found
      	at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139)
      	at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(PropertyPlaceholderDelegateRegistry.java:47)
      	at org.fusesource.fabric.camel.FabricComponent.doStart(FabricComponent.java:101)
      	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
      	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
      	at org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1613)
      	at org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:293)
      	... 43 more
      Caused by: org.osgi.service.blueprint.container.NoSuchComponentException: No component with id 'org.linkedin.zookeeper.client.IZKClient' could be found
      	at org.apache.aries.blueprint.container.DependencyGraph.getSortedRecipes(DependencyGraph.java:51)
      	at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:214)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:198)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:137)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:718)[9:org.apache.aries.blueprint:0.3.1]
      	at org.apache.camel.blueprint.BlueprintContainerRegistry.lookup(BlueprintContainerRegistry.java:38)
      	at org.apache.camel.impl.CompositeRegistry.lookup(CompositeRegistry.java:58)
      	at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(PropertyPlaceholderDelegateRegistry.java:45)
      	... 49 more

      This error disappears when we restart the bundle containing the camel route on the agent

        Gliffy Diagrams

          Activity

          Hide
          cmoulliard Charles Moulliard added a comment -

          This is certainly related to the fact that the interface "org.linkedin.zookeeper.client.IZKClient" is not yet registered in the OSGI registry when camel - blueprint do the lookup

          Do we have to add a blueprint reference into the camel route or modify the fabric camel component to wait till the service is available ?

          Show
          cmoulliard Charles Moulliard added a comment - This is certainly related to the fact that the interface "org.linkedin.zookeeper.client.IZKClient" is not yet registered in the OSGI registry when camel - blueprint do the lookup Do we have to add a blueprint reference into the camel route or modify the fabric camel component to wait till the service is available ?
          Hide
          gnodet Guillaume Nodet added a comment -

          If you add a reference, blueprint will make sure to wait for the service to be registered.
          If you don't, Camel will try to look up the service in its internal registries but won't wait.

          Try to add
          code
          <reference id="org.linkedin.zookeeper.client.IZKClient" interface="org.linkedin.zookeeper.client.IZKClient" />
          code

          Show
          gnodet Guillaume Nodet added a comment - If you add a reference, blueprint will make sure to wait for the service to be registered. If you don't, Camel will try to look up the service in its internal registries but won't wait. Try to add code <reference id="org.linkedin.zookeeper.client.IZKClient" interface="org.linkedin.zookeeper.client.IZKClient" /> code

            People

            • Assignee:
              Unassigned
              Reporter:
              cmoulliard Charles Moulliard
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development