You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by "Teshler, Andre" <An...@tui.de> on 2004/08/19 14:07:44 UTC

Problem with "multiple service points for interface"

I am working with beta-2 and use following configuration for my service:

    <service-point id="TestComponent1"
interface="framework.transaction.TestComponent">
        <invoke-factory service-id="hivemind.BuilderFactory">
            <construct class="framework.transaction.TestComponentImpl">
                <set-service property="component2"
service-id="TestComponent2"/>
            </construct>
        </invoke-factory>
    </service-point>

    <service-point id="TestComponent2"
interface="framework.transaction.TestComponent">
        <invoke-factory service-id="hivemind.BuilderFactory">
            <construct class="framework.transaction.TestComponentImpl">
            </construct>
        </invoke-factory>
    </service-point>


With implementation class:

public class TestComponentImpl implements TestComponent {
 private TestComponent component2;
 public void setComponent2(TestComponent component2) {
  this.component2 = component2;
 }
 // ...
}

TestComponent1 will be initialized correctly, but acessing the property
'component2' I get following exception: 

Unable to autowire property component2 of service
framework.transaction.TestComponent2: There are multiple service points for
interface framework.transaction.TestComponent:
{framework.transaction.TestComponent, framework.transaction.TestComponent2}.

What is wrong here ? It should be possible to define two services with the
same interface (and same implementation class) but different injektions for
member-services.

By the way: this example has worked withe beta-1.

Thanks.

Andre


Re: Problem with "multiple service points for interface"

Posted by Achim Huegen <ah...@gmx-topmail.de>.
Autowiring can be switched off:

  <construct autowire-services="false" class="framework...">
  </construct>


> The definition of TestComponent2 doesn't specify a value for property 
> component2. So autowiring is tried and searches for a unique service 
> that implements the TestComponent interface in order to assign it to 
> property component2. Since two services with this interface exist an 
> error is raised.
> You can fix this by specifying a value for component2, but I dont't know
> how you can leave it null.
> 
> Achim Huegen
> 
> 
> Teshler, Andre wrote:
> 
>> I am working with beta-2 and use following configuration for my service:
>>
>>     <service-point id="TestComponent*1*" 
>> interface="framework.transaction.TestComponent">
>>         <invoke-factory service-id="hivemind.BuilderFactory">
>>             <construct class="framework.transaction.TestComponentImpl">
>>                 <set-service property="*component2*" 
>> service-id="TestComponent*2*"/>
>>             </construct>
>>         </invoke-factory>
>>     </service-point>
>>
>>     <service-point id="TestComponent*2*" 
>> interface="framework.transaction.TestComponent">
>>         <invoke-factory service-id="hivemind.BuilderFactory">
>>             <construct class="framework.transaction.TestComponentImpl">
>>             </construct>
>>         </invoke-factory>
>>     </service-point>
>>
>> With implementation class:
>>
>> public class TestComponentImpl implements TestComponent {
>>  private TestComponent *component2*;
>>  public void setComponent2(TestComponent component2) {
>>   this.component2 = component2;
>>  }
>>  // ...
>> }
>>
>> TestComponent1 will be initialized correctly, but acessing the 
>> property 'component2' I get following exception:
>>
>> /Unable to autowire property component2 of service 
>> framework.transaction.TestComponent2: There are multiple service 
>> points for interface framework.transaction.TestComponent: 
>> {framework.transaction.TestComponent, 
>> framework.transaction.TestComponent2}./
>>
>> What is wrong here ? It should be possible to define two services with 
>> the same interface (and same implementation class) but different 
>> injektions for member-services.
>>
>> By the way: this example has worked withe beta-1.
>>
>> Thanks.
>>
>> Andre
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Re: Problem with "multiple service points for interface"

Posted by Achim Huegen <ah...@gmx-topmail.de>.
The definition of TestComponent2 doesn't specify a value for property 
component2. So autowiring is tried and searches for a unique service 
that implements the TestComponent interface in order to assign it to 
property component2. Since two services with this interface exist an 
error is raised.
You can fix this by specifying a value for component2, but I dont't know
how you can leave it null.

Achim Huegen


Teshler, Andre wrote:

> I am working with beta-2 and use following configuration for my service:
> 
>     <service-point id="TestComponent*1*" 
> interface="framework.transaction.TestComponent">
>         <invoke-factory service-id="hivemind.BuilderFactory">
>             <construct class="framework.transaction.TestComponentImpl">
>                 <set-service property="*component2*" 
> service-id="TestComponent*2*"/>
>             </construct>
>         </invoke-factory>
>     </service-point>
> 
>     <service-point id="TestComponent*2*" 
> interface="framework.transaction.TestComponent">
>         <invoke-factory service-id="hivemind.BuilderFactory">
>             <construct class="framework.transaction.TestComponentImpl">
>             </construct>
>         </invoke-factory>
>     </service-point>
> 
> With implementation class:
> 
> public class TestComponentImpl implements TestComponent {
>  private TestComponent *component2*;
>  public void setComponent2(TestComponent component2) {
>   this.component2 = component2;
>  }
>  // ...
> }
> 
> TestComponent1 will be initialized correctly, but acessing the property 
> 'component2' I get following exception:
> 
> /Unable to autowire property component2 of service 
> framework.transaction.TestComponent2: There are multiple service points 
> for interface framework.transaction.TestComponent: 
> {framework.transaction.TestComponent, 
> framework.transaction.TestComponent2}./
> 
> What is wrong here ? It should be possible to define two services with 
> the same interface (and same implementation class) but different 
> injektions for member-services.
> 
> By the way: this example has worked withe beta-1.
> 
> Thanks.
> 
> Andre
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org