aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Valentin Mahrwald (JIRA)" <>
Subject [jira] Commented: (ARIES-325) static factory methods with the same names are not distinguished during bean instantiation
Date Tue, 01 Jun 2010 16:43:36 GMT


Valentin Mahrwald commented on ARIES-325:

Having analysed this issue offline with Richard, the issue appears to be JVM dependent. On
an IBM J9 (AiX) the hidden factory methods are returned by Class.getMethods() whereas on my
local Mac (Sun) JVM they are not.

I will try to find out who is right, but most likely commit a fix anyway.

> static factory methods with the same names are not distinguished during bean instantiation
> ------------------------------------------------------------------------------------------
>                 Key: ARIES-325
>                 URL:
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>            Reporter: Richard Ellis
>            Assignee: Valentin Mahrwald
>            Priority: Minor
> I have a class SuperClass with a static method:
> public static SuperObject getObject(){...return SuperObject}
> this class is subclassed by SubClass which also has a static method:
> public static SubObject getObject(){...return SubObject}
> where SubObject extends SuperObject
> when I use <bean id="someFactoryBean" class="SubClass" factory-method="getObject"/>
I get a ComponentDefinitionException:
> ServiceRecipe E org.apache.aries.blueprint.container.ServiceRecipe createService Error
retrieving service from ServiceRecipe[name='.component-2']
>                                  org.osgi.service.blueprint.container.ComponentDefinitionException:
Multiple matching factory methods getObject found on class
>                                   my.package.SubClass for arguments [] when instanciating
bean someFactoryBean: [
>                                   public static my.package.SubClass.getObject(), 
>                                   public static my.package.SuperClass.getObject()]
> 	at org.apache.aries.blueprint.container.BeanRecipe.getInstance(
> 	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(
> 	at org.apache.aries.blueprint.di.AbstractRecipe.create(
> 	at org.apache.aries.blueprint.di.RefRecipe.internalCreate(
> 	at org.apache.aries.blueprint.di.AbstractRecipe.create(
> 	at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(
> 	at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(
> 	at org.apache.aries.blueprint.container.BlueprintRepository.create(
> 	at org.apache.aries.blueprint.container.ServiceRecipe.createRecipe(
> 	at org.apache.aries.blueprint.container.ServiceRecipe.createService(
> 	at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(
> 	at org.apache.aries.blueprint.container.ServiceRecipe.getService(
> 	at org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(
> 	at org.eclipse.osgi.internal.serviceregistry.ServiceUse$
> 	at
> 	at org.eclipse.osgi.internal.serviceregistry.ServiceUse.getService(
> 	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(
> 	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(
> 	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.getService(
> 	at org.apache.aries.blueprint.container.BlueprintContainerImpl.getService(
> 	at org.apache.aries.blueprint.container.ReferenceRecipe.getService(
> 	at org.apache.aries.blueprint.container.ReferenceRecipe.access$000(
> 	at org.apache.aries.blueprint.container.ReferenceRecipe$
> 	at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$CgLibProxyFactory$1.loadObject(
> I think the bean should be instantiated using the static method declared on the class
I specified as an attribute.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message