Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
paul-mcculloch opened this issue Jan 10, 2025 · 0 comments

Comments

@paul-mcculloch
Copy link

[Originally logged as https://issues.apache.org/jira/browse/CAMEL-20436 but closed with instructions to log here]

Using OSGi Blueprint a 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 (apache/camel@5d956d2)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant