0
votes

I want to write my own Component for Apache Camel. It works fine when I put parameters in the URI. When I give no parameters it throws an AmbiguousMethodCallException. Why does this happen?

This works:

from("file:in/csv?noop=true")
    .to("cvsToXml:?delimiterChar=;")
    .to("file:out/csv");

This does not:

from("file:in/csv?noop=true")
    .to("cvsToXml")
    .to("file:out/csv");

The error:

org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous method invocations possible: [public org.apache.camel.Endpoint org.apache.camel.impl.DefaultComponent.createEndpoint(java.lang.String) throws java.lang.Exception, public org.apache.camel.EndpointConfiguration org.apache.camel.impl.DefaultComponent.createConfiguration(java.lang.String) throws java.lang.Exception]. Exchange[Message: Header1;Header2;Header3;Header4;Header5;Header6;Header7;Header8;Header9;Header10 Value1_1;Value2_1;Value3_1;Value4_1;Value5_1;Value6_1;Value7_1;Value8_1;Value9_1;Value10_1 Value1_2;Value2_2;Value3_2;Value4_2;Value5_2;Value6_2;Value7_2;Value8_2;Value9_2;Value10_2 Value1_3;Value2_3;Value3_3;Value4_3;Value5_3;Value6_3;Value7_3;Value8_3;Value9_3;Value10_3 Value1_4;Value2_4;Value3_4;Value4_4;Value5_4;Value6_4;Value7_4;Value8_4;Value9_4;Value10_4 Value1_5;Value2_5;Value3_5;Value4_5;Value5_5;Value6_5;Value7_5;Value8_5;Value9_5;Value10_5 Value1_6;Value2_6;Value3_6;Value4_6;Value5_6;Value6_6;Value7_6;Value8_6;Value9_6;Value10_6 Value1_7;Value2_7;Value3_7;Value4_7;Value5_7;Value6_7;Value7_7;Value8_7;Value9_7;Value10_7 Value1_8;Value2_8;Value3_8;Value4_8;Value5_8;Value6_8;Value7_8;Value8_8;Value9_8;Value10_8 Value1_9;Value2_9;Value3_9;Value4_9;Value5_9;Value6_9;Value7_9;Value8_9;Value9_9;Value10_9 Value1_10;Value2_10;Value3_10;Value4_10;Value5_10;Value6_10;Value7_10;Value8_10;Value9_10;Value10_10... [Body clipped after 1000 chars, total length is 2012]]
    at org.apache.camel.component.bean.BeanInfo.chooseBestPossibleMethodInfo(BeanInfo.java:745)
    at org.apache.camel.component.bean.BeanInfo.chooseMethodWithMatchingBody(BeanInfo.java:676)
    at org.apache.camel.component.bean.BeanInfo.chooseMethod(BeanInfo.java:544)
    at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:273)
    at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:180)
    at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:149)
    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
    at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
    at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
    at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:423)
    at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:211)
    at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:175)
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
1

1 Answers

1
votes

The first line gives you a big clue as to what is going wrong. (Reformatted to enhance readability)

org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous method invocations possible: 
public org.apache.camel.Endpoint 
org.apache.camel.impl.DefaultComponent.createEndpoint(java.lang.String) throws java.lang.Exception
public org.apache.camel.EndpointConfiguration 
org.apache.camel.impl.DefaultComponent.createConfiguration(java.lang.String) throws java.lang.Exception

The arguments you are passing in can be applied to more than one method.
Keyword Ambiguous