[ https://issues.apache.org/jira/browse/ARIES-1282?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume Nodet resolved ARIES-1282. ------------------------------------ Resolution: Fixed Assignee: Guillaume Nodet Fix Version/s: blueprint-core-1.9.0 Committing to https://svn.apache.org/repos/asf/aries/trunk ... A blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/CachePojos.java A blueprint/blueprint-core/src/test/resources/test-cache.xml M blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/generics/TypeInference.java M blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/WiringTest.java Committed r1822771 > BeanRecipe.findMatchingMethods is not able to filter out overridden method > signatures > ------------------------------------------------------------------------------------- > > Key: ARIES-1282 > URL: https://issues.apache.org/jira/browse/ARIES-1282 > Project: Aries > Issue Type: Bug > Components: Blueprint > Affects Versions: blueprint-core-1.1.0, blueprint-core-1.4.2 > Reporter: Niels Bertram > Assignee: Guillaume Nodet > Priority: Major > Fix For: blueprint-core-1.9.0 > > > I was trying to get an Infinispan cache object from an infinispan > CacheManager using the following blueprint configuration: > {code:xml} > <reference id="cacheManager" availability="mandatory" > interface="org.infinispan.manager.CacheContainer" /> > <bean id="queueCountCache" factory-ref="cacheManager" > factory-method="getCache"> > <argument index="0" type="java.lang.String" value="QueueCountCache" /> > </bean> > {code} > Unfortunately the blueprint startup fails with following error: > {code} > org.osgi.service.blueprint.container.ComponentDefinitionException: Multiple > matching factory methods getCache found on class > Proxy36341b52_07db_4c05_bab0_40dbf8a3899a for arguments [QueueCountCache] > when instanciating bean queueCountCache: [public > org.infinispan.commons.api.BasicCache > Proxy36341b52_07db_4c05_bab0_40dbf8a3899a.getCache(java.lang.String), public > org.infinispan.Cache > Proxy36341b52_07db_4c05_bab0_40dbf8a3899a.getCache(java.lang.String)] > at > org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:305)[7:org.apache.aries.blueprint.core:1.4.0] > at > org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)[7:org.apache.aries.blueprint.core:1.4.0] > at > org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[7:org.apache.aries.blueprint.core:1.4.0] > ... > {code} > looking at the matches produced by the {{BeanRecipe.findMatchingMethods}} > makes it obvious that the {{CacheContainer}} implements an interface > {{BasicCacheContainer}}. The {{CacheContainer}} interface overrides the > getCache(java.lang.String) that is initially defined in the > {{BasicCacheContainer}} without any changes. I guess this was implemented for > some backward compatibility. > {code} > public org.infinispan.commons.api.BasicCache > Proxy6e18b006_c93d_4840_bb4d_3522802f6a68.getCache(java.lang.String)=[QueueCountCache] > {code} > and > {code} > public org.infinispan.Cache > Proxy6e18b006_c93d_4840_bb4d_3522802f6a68.getCache(java.lang.String)=[QueueCountCache] > {code} > The {{BeanRecipe.findMatchingMethods}} probably also needs to check if the > method signatures found are overridden by another method in the matching > collection. If that is the case, all methods that are overridden also need to > be discharged. > Here are the 2 offending interfaces that the {{BeanReceipe}} matches. > Unfortunately the CacheContainer getCache method is the one it should match > but +not+ the one from BasicCacheContainer. > {code:title=CacheContainer.java|borderStyle=solid} > package org.infinispan.manager; > import org.infinispan.Cache; > import org.infinispan.commons.api.BasicCache; > import org.infinispan.commons.api.BasicCacheContainer; > public interface CacheContainer extends BasicCacheContainer { > @Override > <K, V> Cache<K, V> getCache(); > @Override > <K, V> Cache<K, V> getCache(String cacheName); > } > {code} > {code:title=BasicCacheContainer.java|borderStyle=solid} > package org.infinispan.commons.api; > public interface BasicCacheContainer extends Lifecycle { > > <K, V> BasicCache<K, V> getCache(); > <K, V> BasicCache<K, V> getCache(String cacheName); > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)