Rastislav Papp created CAMEL-19049:
--------------------------------------
Summary: camel-bean: AmbiguousMethodCallException when using OSGi
service reference
Key: CAMEL-19049
URL: https://issues.apache.org/jira/browse/CAMEL-19049
Project: Camel
Issue Type: Bug
Components: camel-karaf
Affects Versions: 3.14.6
Reporter: Rastislav Papp
After upgrading from 3.14.4 to 3.14.6 we can no longer call camel bean method
on an instance of OSGI service which implements an interface. This is caused by
the changes introduced in CAMEL-18411.
Example:
route:
{code:java}
public class TestRoute extends RouteBuilder {
@BeanInject
private MyInterface myInterface;
@Override
public void configure() {
from("...")
.bean(myInterface, "reinit");
}
}
{code}
The {{MyInterface}} is:
{code}
public interface MyInterface {
void reinit();
}
{code}
The object inserted is a proxy reference to OSGI service, injected by blueprint
in karaf runtime.
Stacktrace:
{code}
org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous method
invocations possible: [public void
Proxyb113d9d3_4aac_4ac9_b619_9bb68d221255.reinit(), public abstract void
foo.bar.MyInterface.reinit()] on the exchange:
Exchange[92BC3141E43445D-000000000000003F] at
org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:246) at
org.apache.camel.component.bean.AbstractBeanProcessor.process(AbstractBeanProcessor.java:126)
at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:81) at
org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:818)
at
org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:726)
at
org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:193)
at
org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:64)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:185) at
{code}
The ambiguousness is caused by the {{reinit()}} method detected twice - once
from the interface, and one from the {{Proxy}} class.
I'm working on a solution.
cc: [~AWeickel]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)