Sounds similar to something I found when I upgraded from Camel 2-3 - https://issues.apache.org/jira/browse/CAMEL-20436.
Paul On Fri, 5 Apr 2024 at 15:42, Gawie van der Merwe <ga...@adumo.com.invalid> wrote: > Hi guys, > > We seeing some strange behavior. Camel 3.21.2. > > Before: > -------------- > > We have bean: > > public class IMapHelperImpl { > > public void addPropToIMap(String trackID, String key, Object value, > Exchange exchange) { > // some code > } > > } > > In blueprint.xml we configure the bean: > <bean id="IMapHelperImpl" > class="com.youngtew.miniswitch.common.IMapHelperImpl"> > > And use it only passing 3 params. "Exchange" is a Camel-specific type, and > dont need to be passed. > <camel:bean ref="IMapHelper" > method="addPropToIMap(${header.customTrackID}, 'Message_Protocol', 'DMS')" > /> > > And this has always worked fine. > > After: > ---------------- > Now we moved the bean to bundle A and created a interface and register it > as a service in bundle A: > > public interface IMapHelper { > void addPropToIMap(String trackID, String key, Object value, Exchange > exchange); > } > > public class IMapHelperImpl implements IMapHelper{ > @Override > public void addPropToIMap(String trackID, String key, Object value, > Exchange exchange) { > // some code > } > } > > Declare as service in blueprint: > <bean id="IMapHelperImpl" > class="com.youngtew.miniswitch.common.impl.IMapHelperImpl"> > <property name="txMapProp" ref="instance"/> > </bean> > <service interface="com.youngtew.miniswitch.common.IMapHelper" > ref="IMapHelperImpl"/> > > In bundle B we access and use the service in a camel route like before: > <reference id="IMapHelper" > interface="com.youngtew.miniswitch.common.IMapHelper" /> > > <camel:bean ref="IMapHelper" > method="addPropToIMap(${header.customTrackID}, 'Message_Protocol', 'DMS')" > /> > > But we keep getting: > Caused by: org.apache.camel.component.bean.AmbiguousMethodCallException: > Ambiguous method invocations possible: [ > public void > Proxyafd06aa7_d318_48fc_83c8_c1fca7b2423c.addPropToIMap(java.lang.String,java.lang.String,java.lang.Object,org.apache.camel.Exchange), > public abstract void > com.youngtew.miniswitch.common.IMapHelper.addPropToIMap(java.lang.String,java.lang.String,java.lang.Object,org.apache.camel.Exchange)] > on the exchange: Exchange[FB35D15A8E52D13-0000000000000000] > > Although there is just one method with that name. > > We can solve it with a work around by passing all 4 params by adding > ${exchange}, and it works: > <camel:bean ref="IMapHelper" > method="addPropToIMap(${header.customTrackID}, 'Message_Protocol', 'DMS', > ${exchange})" /> > > So I was womdering what am I missing with regards to the bean binding when > using it as a service compared to a local bean declaration. > > Thanks for any suggestions. > > Gabriel >