You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by buzzterrier <te...@gmail.com> on 2009/06/16 01:08:47 UTC

AmbiguousMethodCallException

Hello,

I have the following routes:


public void configure() throws Exception {
	
from("activemq:queue:purchaseorder:transid").beanRef("purchaseOrderService",
"getByTransId(String)");
	
from("activemq:queue:purchaseorder:externalId").beanRef("purchaseOrderService",
"getByExternalId(String)");
	}



and I call it using:

	PurchaseOrder po = (PurchaseOrder)
camelTemplate.sendBody("activemq:queue:purchaseorder:transid",
            ExchangePattern.InOut, poid);
		System.out.println("POID: " + po.getTranId());


The server throws and AmbiguousMethodCallException.  I thought the
activemq:queue:purchaseorder:transid route would differentiate the method
call from activemq:queue:purchaseorder:externalId. Am I going about this the
wrong way?

-----
Buzzterrier

http://buzzterrier.blogspot.com/ View my blog: Ordinary Average Developer... 
-- 
View this message in context: http://www.nabble.com/AmbiguousMethodCallException-tp24042324p24042324.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: AmbiguousMethodCallException

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jun 18, 2009 at 8:34 AM, Claus Ibsen <cl...@gmail.com> wrote:

>
>
> On Tue, Jun 16, 2009 at 6:33 AM, Claus Ibsen <cl...@gmail.com>wrote:
>
>> Hi
>>
>> What version of Camel are you using?
>>
>> Looks like we should have had another excpetion being thrown when end
>> user provided the method name to invoke but it does not exist.
>
>
> Works fine in Camel 2.0. I added an unit test for
> it: BeanWithMethodHeaderTest
>

Sorry was to fast. When you have explict given a method name Camel should of
course thrown an exception if the method does not exist.



>
>
>>
>>
>>
>> On Tue, Jun 16, 2009 at 3:12 AM, Willem Jiang<wi...@gmail.com>
>> wrote:
>> > Hi
>> >
>> > The beanRef(String ref, String method) 's method parameter is the method
>> > name, it doesn't include the method parameter types.
>> > So you just need to change your route rule like this
>> >
>> >
>> from("activemq:queue:purchaseorder:transid").beanRef("purchaseOrderService",
>> > "getByTransId");
>> >
>> >
>> from("activemq:queue:purchaseorder:externalId").beanRef("purchaseOrderService",
>> >  "getByExternalId");
>> >
>> > Willem
>> >
>> > buzzterrier wrote:
>> >> Hello,
>> >>
>> >> I have the following routes:
>> >>
>> >>
>> >> public void configure() throws Exception {
>> >>
>> >>
>> from("activemq:queue:purchaseorder:transid").beanRef("purchaseOrderService",
>> >> "getByTransId(String)");
>> >>
>> >>
>> from("activemq:queue:purchaseorder:externalId").beanRef("purchaseOrderService",
>> >> "getByExternalId(String)");
>> >>       }
>> >>
>> >>
>> >>
>> >> and I call it using:
>> >>
>> >>       PurchaseOrder po = (PurchaseOrder)
>> >> camelTemplate.sendBody("activemq:queue:purchaseorder:transid",
>> >>             ExchangePattern.InOut, poid);
>> >>               System.out.println("POID: " + po.getTranId());
>> >>
>> >>
>> >> The server throws and AmbiguousMethodCallException.  I thought the
>> >> activemq:queue:purchaseorder:transid route would differentiate the
>> method
>> >> call from activemq:queue:purchaseorder:externalId. Am I going about
>> this the
>> >> wrong way?
>> >>
>> >> -----
>> >> Buzzterrier
>> >>
>> >> http://buzzterrier.blogspot.com/ View my blog: Ordinary Average
>> Developer...
>> >
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
>


-- 
Claus Ibsen
Apache Camel Committer

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

Re: AmbiguousMethodCallException

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jun 16, 2009 at 6:33 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> What version of Camel are you using?
>
> Looks like we should have had another excpetion being thrown when end
> user provided the method name to invoke but it does not exist.


Works fine in Camel 2.0. I added an unit test for
it: BeanWithMethodHeaderTest


>
>
>
> On Tue, Jun 16, 2009 at 3:12 AM, Willem Jiang<wi...@gmail.com>
> wrote:
> > Hi
> >
> > The beanRef(String ref, String method) 's method parameter is the method
> > name, it doesn't include the method parameter types.
> > So you just need to change your route rule like this
> >
> >
> from("activemq:queue:purchaseorder:transid").beanRef("purchaseOrderService",
> > "getByTransId");
> >
> >
> from("activemq:queue:purchaseorder:externalId").beanRef("purchaseOrderService",
> >  "getByExternalId");
> >
> > Willem
> >
> > buzzterrier wrote:
> >> Hello,
> >>
> >> I have the following routes:
> >>
> >>
> >> public void configure() throws Exception {
> >>
> >>
> from("activemq:queue:purchaseorder:transid").beanRef("purchaseOrderService",
> >> "getByTransId(String)");
> >>
> >>
> from("activemq:queue:purchaseorder:externalId").beanRef("purchaseOrderService",
> >> "getByExternalId(String)");
> >>       }
> >>
> >>
> >>
> >> and I call it using:
> >>
> >>       PurchaseOrder po = (PurchaseOrder)
> >> camelTemplate.sendBody("activemq:queue:purchaseorder:transid",
> >>             ExchangePattern.InOut, poid);
> >>               System.out.println("POID: " + po.getTranId());
> >>
> >>
> >> The server throws and AmbiguousMethodCallException.  I thought the
> >> activemq:queue:purchaseorder:transid route would differentiate the
> method
> >> call from activemq:queue:purchaseorder:externalId. Am I going about this
> the
> >> wrong way?
> >>
> >> -----
> >> Buzzterrier
> >>
> >> http://buzzterrier.blogspot.com/ View my blog: Ordinary Average
> Developer...
> >
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>



-- 
Claus Ibsen
Apache Camel Committer

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

Re: AmbiguousMethodCallException

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What version of Camel are you using?

Looks like we should have had another excpetion being thrown when end
user provided the method name to invoke but it does not exist.


On Tue, Jun 16, 2009 at 3:12 AM, Willem Jiang<wi...@gmail.com> wrote:
> Hi
>
> The beanRef(String ref, String method) 's method parameter is the method
> name, it doesn't include the method parameter types.
> So you just need to change your route rule like this
>
> from("activemq:queue:purchaseorder:transid").beanRef("purchaseOrderService",
> "getByTransId");
>
> from("activemq:queue:purchaseorder:externalId").beanRef("purchaseOrderService",
>  "getByExternalId");
>
> Willem
>
> buzzterrier wrote:
>> Hello,
>>
>> I have the following routes:
>>
>>
>> public void configure() throws Exception {
>>
>> from("activemq:queue:purchaseorder:transid").beanRef("purchaseOrderService",
>> "getByTransId(String)");
>>
>> from("activemq:queue:purchaseorder:externalId").beanRef("purchaseOrderService",
>> "getByExternalId(String)");
>>       }
>>
>>
>>
>> and I call it using:
>>
>>       PurchaseOrder po = (PurchaseOrder)
>> camelTemplate.sendBody("activemq:queue:purchaseorder:transid",
>>             ExchangePattern.InOut, poid);
>>               System.out.println("POID: " + po.getTranId());
>>
>>
>> The server throws and AmbiguousMethodCallException.  I thought the
>> activemq:queue:purchaseorder:transid route would differentiate the method
>> call from activemq:queue:purchaseorder:externalId. Am I going about this the
>> wrong way?
>>
>> -----
>> Buzzterrier
>>
>> http://buzzterrier.blogspot.com/ View my blog: Ordinary Average Developer...
>
>



-- 
Claus Ibsen
Apache Camel Committer

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

Re: AmbiguousMethodCallException

Posted by Willem Jiang <wi...@gmail.com>.
Hi

The beanRef(String ref, String method) 's method parameter is the method
name, it doesn't include the method parameter types.
So you just need to change your route rule like this

from("activemq:queue:purchaseorder:transid").beanRef("purchaseOrderService",
"getByTransId");

from("activemq:queue:purchaseorder:externalId").beanRef("purchaseOrderService",
 "getByExternalId");

Willem

buzzterrier wrote:
> Hello,
> 
> I have the following routes:
> 
> 
> public void configure() throws Exception {
> 	
> from("activemq:queue:purchaseorder:transid").beanRef("purchaseOrderService",
> "getByTransId(String)");
> 	
> from("activemq:queue:purchaseorder:externalId").beanRef("purchaseOrderService",
> "getByExternalId(String)");
> 	}
> 
> 
> 
> and I call it using:
> 
> 	PurchaseOrder po = (PurchaseOrder)
> camelTemplate.sendBody("activemq:queue:purchaseorder:transid",
>             ExchangePattern.InOut, poid);
> 		System.out.println("POID: " + po.getTranId());
> 
> 
> The server throws and AmbiguousMethodCallException.  I thought the
> activemq:queue:purchaseorder:transid route would differentiate the method
> call from activemq:queue:purchaseorder:externalId. Am I going about this the
> wrong way?
> 
> -----
> Buzzterrier
> 
> http://buzzterrier.blogspot.com/ View my blog: Ordinary Average Developer...