You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Nawaz <na...@progress.com> on 2009/10/21 12:34:47 UTC
Probem in Bean element
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.
Re: Probem in Bean element
Posted by Willem Jiang <wi...@gmail.com>.
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 <na...@progress.com> 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
>>
>>
>
Re: Probem in Bean element
Posted by James Strachan <ja...@gmail.com>.
If you're still having trouble after reading all of the replies on
this thread, try create a stand alone JUnit test case demonstrating
your issue - then post it here then folks can fix it & we get another
test case too.
2009/10/21 Nawaz <na...@progress.com>:
>
> 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 <na...@progress.com> 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
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Probem-in-Bean-element-tp25990048p25990329.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/
Re: Probem in Bean element
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
See this unit test I just added
http://svn.apache.org/viewvc?rev=827962&view=rev
On Wed, Oct 21, 2009 at 12:56 PM, Nawaz <na...@progress.com> 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 <na...@progress.com> 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
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Probem-in-Bean-element-tp25990048p25990329.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
Re: Probem in Bean element
Posted by Nawaz <na...@progress.com>.
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 <na...@progress.com> 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
>
>
--
View this message in context: http://www.nabble.com/Probem-in-Bean-element-tp25990048p25990329.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Probem in Bean element
Posted by Claus Ibsen <cl...@gmail.com>.
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 <na...@progress.com> 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