when the component is implemented by a composite which has multi service,occur 
can't find service error.
--------------------------------------------------------------------------------------------------------

                 Key: TUSCANY-1405
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1405
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Assembly Model
    Affects Versions: Java-SCA-0.90
            Reporter: wangfeng
             Fix For: Java-SCA-0.91


I create a simple SCA application,which test composite Implementation.I defined 
two composite files,one is OuterComposite.composite,the other is 
InnerComposite.composite and the Innercomposite file has defined two composite 
services.
when I get a service (offer a service name to the getService method) from the 
component which defined in the OuterComposite file ,occur an error as below.
Exception in thread "main" org.osoa.sca.ServiceRuntimeException: Service not 
found: TargetComponent/Service_Two
        at 
org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.getService(DefaultSCADomain.java:278)
        at composite.CompositeClient.main(CompositeClient.java:31)

OuterComposite.composite
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
    targetNamespace="http://sample";
    xmlns:sample="http://sample";
    name="OuterComposite">
    <component name="TargetComponent">
        <implementation.composite name="sample:InnerComposite"/>
    </component>
</composite>

InnerComposite.composite
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
    targetNamespace="http://sample";
    xmlns:sample="http://sample";
    name="InnerComposite">
   <service name="Service_One" promote="ComponentOne"> 
        <interface.java interface="composite.Target"/>
    </service>
    <service name="Service_Two" promote="ComponentTwo"> 
        <interface.java interface="composite.Target"/>
    </service>
    <component name="ComponentOne">
          <implementation.java class="composite.TargetOne"/>
    </component>
    <component name="ComponentTwo">
          <implementation.java class="composite.TargetTwo"/>
    </component>
</composite>

Target.java
package composite;
public interface Target {
    String hello(String arg);
}

TargetOne.java
package composite;
import org.osoa.sca.annotations.Service;
@Service(Target.class)
public class TargetOne implements Target {
      public String hello(String arg) {
            return "TargetOne: Hello " + arg+ "!";
      }
}

TargetTwo.java
package composite;
import org.osoa.sca.annotations.Service;
@Service(Target.class)
public class TargetTwo implements Target {
    public String hello(String arg) {
             return "TargetTwo: Hello " + arg + "!";
    }
}

CompositeClient .java
package composite;
import org.apache.tuscany.sca.host.embedded.SCADomain;
public class CompositeClient {
    public static void main(String[] args) throws Exception {
        SCADomain scaDomain = SCADomain.newInstance("OuterComposite.composite");
        Target target = scaDomain.getService(Target.class, 
"TargetComponent/Service_Two");
        String res = target.hello("Wang Feng");
        System.out.println(res);
        scaDomain.close();
    }
}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to