Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-19049

camel-bean: AmbiguousMethodCallException when using OSGi service reference

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 3.14.6
    • None
    • camel-bean
    • None
    • Unknown

    Description

      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:

      public class TestRoute extends RouteBuilder {
      
          @BeanInject
          private MyInterface myInterface;
      
          @Override
          public void configure() {
              from("...")
                  .bean(myInterface, "reinit");
      
          }
      
      }
      

      The MyInterface is:

      public interface MyInterface {
          void reinit();
      }
      

      The object injected is a proxy reference to OSGI service, injected by blueprint in karaf runtime.

      Stacktrace:

      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
      

      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

      Attachments

        1. test.xml
          0.4 kB
          Robert Schulte
        2. screenshot-1.png
          89 kB
          Rastislav Papp

        Activity

          People

            Unassigned Unassigned
            rastislav.papp Rastislav Papp
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: