[
https://issues.apache.org/jira/browse/CAMEL-19049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17746847#comment-17746847
]
Robert Schulte commented on CAMEL-19049:
----------------------------------------
I have done some cross-testing and I think I can narrow the issue down.
I tried to create a minimal example that turned out to work just fine on
vanilla Karaf (with feature camel-blueprint 3.21.0). To my suprise, it also
worked in our customized Karaf distro:
[^test.xml]
By now, I am pretty sure that there is no general issue with using a bean that
resolves from the OSGi service registry. In our case, it is the probably the
combination with Apache Aries JPA blueprint that causes the issue. I need to do
some more tests, but my guess would be that I get the
AmbiguousMethodCallException when using
http://aries.apache.org/xmlns/transactions regardless of declaring a bean
locally or retrieving it via the service registry.
[~rastislav.papp], are we experiencing similar issues or is your case
different? Does {{@BeanInject}} work for you, if reference something simple
like org.apache.karaf.system.SystemService 's getVersion method? Does the
implementation of your service use Aries JPA?
> 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, test.xml
>
>
> 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)