我想为Apache Camel编写自己的Component。当我在URI中放置参数时,它工作正常。当我没有给出参数时,它会抛出一个AmbiguousMethodCallException。为什么会这样?
这有效:
from("file:in/csv?noop=true")
.to("cvsToXml:?delimiterChar=;")
.to("file:out/csv");
这不是:
from("file:in/csv?noop=true")
.to("cvsToXml")
.to("file:out/csv");
错误:
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)
答案 0 :(得分:1)
第一行为您提供了一个关于出错的重要线索。 (重新格式化以增强可读性)
>>> import numpy as np
>>> x = np.array([5, 4, 3, 2, 1])
>>> x[x>3]=3
>>> x
array([3, 3, 3, 2, 1])
您传入的参数可以应用于多种方法 关键字歧义