[ 
https://issues.apache.org/jira/browse/CAMEL-19049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17689620#comment-17689620
 ] 

Rastislav Papp commented on CAMEL-19049:
----------------------------------------

[~bjornomy], [~AWeickel], [~davsclaus], I've tracked this down to this change 
in {{BeanInfo}}:
 !screenshot-1.png! 

Adding the exclusion for methods of synthetic classes to 
{{#findMostSpecificOverride}}. When the class is a Proxy created by aries-proxy 
(e.g. referenced osgi service in karaf runtime), the BeanInfo finds 2 methods 
with the same name, one in the original class and one in the synthetic Proxy, 
and decides they do not override each other. Therefore it throws 
AmbiguousMethodCallException, when trying to invoke the method.



> 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-bean
>    Affects Versions: 3.14.6
>            Reporter: Rastislav Papp
>            Priority: Minor
>         Attachments: screenshot-1.png
>
>
> 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 injected 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)

Reply via email to