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

osgi - Bean method invocations where the bean is a proxy for an Interface & the method has no arguments fail with AmbiguousMethodCallException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Abandoned
    • 3.22.1
    • None
    • osgi
    • None
    • Karaf 4.4.4/Java 17/Windows

    • Unknown

    Description

      Using OSGi Blueprint a <reference> element can be used to inject an OSGi service into Camel. Methods on the injected service can be called via "bean:someref?method=foo"

      The service is injected as a proxy to the actual OSGi service,

      When BeanInfo attempts to resolve the method it sees two methods named 'foo' : The abstract method of the interface,  and the concrete method of the proxy.

      In camel 3.16 & earlier BeanInfo.findMostSpecificOverride() would determine that one method overrode the other, and would return the proxy's method.

      From 3.17 onwards a changes was made to look at the method's declaring class' isSynthetic() value, and to not consider a synthetic class' method as overriding the interface. The blueprint proxy is synthetic so is affected. 

       

      The changes was made for https://issues.apache.org/jira/browse/CAMEL-17844 (https://github.com/apache/camel/pull/7261/commits/5d956d2e4914a5c4fe73e5cae2f2ea7d2429f8e3)

       

      This can be worked around by changing the method to take at least one argument. This triggers a different path through the code  - attempting to match the exchange body to the parameter. In this path the isSynthetic() flag isn't considered.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            paulmcculloch Paul McCulloch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: