3 Replies Latest reply on May 15, 2014 10:19 AM by rahul vashishth

    No bean could be found in the registry for: beanName - fabric failover not working

    rahul vashishth Novice

      i am trying to use camel fabric component for load balancing but i am getting

      org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: userProfileService of type: org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean

       

       

      i am following the below example--

      https://access.redhat.com/site/documentation/en-US/Red_Hat_JBoss_Fuse/6.0/html/EIP_Component_Reference/files/Fabric.html

       

       

       

       

      Following are my two server client camel files-

      In my project A, i have created a web service and registered the IZKClient,

      and in camel route i have defined the endpoint with fabric:clusterid component and deployed to server

       

       

        <cxf:rsServer id="userProfileService"

        address="http://0.0.0.0:10226/userProfile"

        serviceClass="com.test.esb.service.licence.GetLicenceThresholdServiceImpl"

        loggingFeatureEnabled="true">

        <cxf:providers>

                   <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>

               </cxf:providers>

        </cxf:rsServer>

       

        <!-- Reference the fabric agent -->

           <osgi:reference id="IZKClient"

               interface="org.fusesource.fabric.zookeeper.IZKClient" />

       

       

        <route id="licenceRoute">

        <from uri="fabric:myclusterid:cxfrs://bean://userProfileService" />

        <setBody>

        <constant>false</constant>

        </setBody>

        <!-- transform response type -->

        <convertBodyTo type="java.lang.Boolean" />

        </route>

       

       

       

      In my second project B i have created a simple pass through proxy using jetty

       

       

       

       

        <osgi:reference id="IZKClient"

              interface="org.fusesource.fabric.zookeeper.IZKClient" />

       

        <route id="licenceRoute">

        <!-- getting request for licence service -->

        <from uri="jetty:http://localhost:8090/userProfile?matchOnUriPrefix=true" />

        <camel:convertBodyTo type="java.lang.String"/>

        <camel:log message="request body---- ${body}"/>

        <to uri="fabric:myclusterid"/>

        </route>

       

       

      Now when i deploy the project B i am getting bean not found for "userProfileService". That means my client code is

      able to look into the cluster with "myclusterid" but it couldnt find the bean object there.

       

       

      I am trying to achieve failover and load balancing for my restfull web-services, any help would be great.

        • 3. Re: No bean could be found in the registry for: beanName - fabric failover not working
          rahul vashishth Novice

          Hi Claus,

          I have tried the same in jboss-fuse-6.1-redhat-379.  There also i am getting the same exception.

          I have followed the following link

          https://access.redhat.com/site/documentation/en-US/Red_Hat_JBoss_Fuse/6.1/html/Apache_Camel_Component_Reference/files/Fabric.html

          I am attaching the src project and steps to regenerate the same exception.

          One thing i am curious about i am able to register the endpoint in registry and i can see it there but still started status is showing as false.

          Check the image for the same. Here "testClusterID" is the name of cluster.

          We recently got the redhat license but the support responses wasn't good enough .

           

          Untitled.png

           

          Following are my two camel-route

          -----------------------------------------------

          Server

          --------

          <import resource="classpath:META-INF/spring/UserProfileSpringContext.xml" />

           

              <osgi:reference id="curator" interface="org.apache.curator.framework.CuratorFramework"/>

           

              <bean id="fabric-camel" class="io.fabric8.camel.FabricComponent">

                  <property name="curator" ref="curator"/>

              </bean>

             

              <camelContext xmlns="http://camel.apache.org/schema/spring">

               <propertyPlaceholder location="config/RestServicesConfig.properties" id="properties"/>

              <!-- Defining route -->

                  <route id="licenceRoute">

                  <!-- getting request for licence service -->

                      <from uri="fabric-camel:testClusterID:cxfrs://bean://userProfileService" />

                      <setBody>

                          <constant>false</constant>

                      </setBody>

                      <!-- transform response type -->

                      <convertBodyTo type="java.lang.Boolean" />

                  </route>

              </camelContext>

           

          ----------------------------

          Client-LoadBalancer

          ------------------------------------------

          <osgi:reference id="curator" interface="org.apache.curator.framework.CuratorFramework"/>

           

                <bean id="fabric-camel" class="io.fabric8.camel.FabricComponent">

                  <property name="curator" ref="curator"/>

                </bean>

           

              <camelContext xmlns="http://camel.apache.org/schema/spring">

              <!-- Defining route -->

                  <route id="licenceRoute">

                  <!-- getting request for licence service -->

                      <from uri="jetty:http://localhost:8090/userProfile?matchOnUriPrefix=true" />

                      <camel:convertBodyTo type="java.lang.String"/>

                      <camel:log message="request body---- ${body}"/>

                      <to uri="fabric-camel:testClusterID"/>

                  </route>

              </camelContext>

             

              <osgi:reference id="componentResolver" interface="org.apache.camel.spi.ComponentResolver"

                        filter="(component=cxfrs)"/>

           

           

           

          ExceptionTrace:-

           

          Caused by: org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: userProfileService of type: org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean

          at org.apache.camel.util.CamelContextHelper.mandatoryLookup(CamelContextHelper.java:151)[107:org.apache.camel.camel-core:2.12.0.redhat-610379]

          at org.apache.camel.component.cxf.jaxrs.CxfRsComponent.createEndpoint(CxfRsComponent.java:55)[109:org.apache.camel.camel-cxf:2.12.0.redhat-610379]

          at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:123)[107:org.apache.camel.camel-core:2.12.0.redhat-610379]