Hi,

You can try to create a camel context from the Spring application context, and put the RouterBuilder into that camel context.

You just need to put the bean's definition into the Spring configuration like this

<bean id="YourBeanName" class="YourBeanClass" />

Willem


Nawaz wrote:
But still i am getting the same exception even after including the below line CamelContext camel = new DefaultCamelContext(context); in the code.

  Is there any other condition to taken care in Bean component?

Regards
Nawaz Ahmed


Claus Ibsen-2 wrote:
Hi

As said before you need to pass your jndi context to CamelContext


JndiContext context = new JndiContext();
context.bind("myBeanId",new SayService());

CamelContext camel = new DefaultCamelContext(context);

camel.addRoutes(new RouteBuilder() {
  ... inline the route builder
});
camel.start();




On Wed, Oct 21, 2009 at 12:34 PM, Nawaz <[email protected]> wrote:
I am using the Bean element, Where JNDI context is created and it refers
to
the SayService class …
          After that below one DSL route is created consisting of BeanRef
Camel component.

          On running this configuration, below exception is reported
          org.apache.camel.NoSuchBeanException: No bean could be found in
the registry for: myBeanId

            Referred this site,  but could not get any help.

            In what way I can register the bean?    Please help me in
this
regard.

            Please see the code below:

                                 // Creating the JNDI context.
           JndiContext context;
           try
           {
                 context = new JndiContext();
                 context.bind("myBeanId",new SayService());
                             }
           catch(Exception e)
           {
                 e.printStackTrace();
           }


           from("jms:queue:nq1").
           //to("bean:bye")
           beanRef("myBeanId","printhello")
           .to("jms:queue:nq2");

--
View this message in context:
http://www.nabble.com/Probem-in-Bean-element-tp25990048p25990048.html
Sent from the Camel - Users mailing list archive at Nabble.com.




--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus




Reply via email to