You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "wangfeng (JIRA)" <tu...@ws.apache.org> on 2007/07/03 08:32:04 UTC

[jira] Created: (TUSCANY-1405) when the component is implemented by a composite which has multi service,occur can't find service error.

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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Resolved: (TUSCANY-1405) when the component is implemented by a composite which has multi service,occur can't find service error.

Posted by "Raymond Feng (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1405?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raymond Feng resolved TUSCANY-1405.
-----------------------------------

    Resolution: Fixed

Fixed under r558146

> 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
>            Assignee: Raymond Feng
>             Fix For: Java-SCA-0.91
>
>         Attachments: ConmpositeImplementation.jar
>
>
> 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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Assigned: (TUSCANY-1405) when the component is implemented by a composite which has multi service,occur can't find service error.

Posted by "Raymond Feng (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1405?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raymond Feng reassigned TUSCANY-1405:
-------------------------------------

    Assignee: Raymond Feng

Thank you for reporting this issue and I can reproduce/identify the problem now. 

> 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
>            Assignee: Raymond Feng
>             Fix For: Java-SCA-0.91
>
>         Attachments: ConmpositeImplementation.jar
>
>
> 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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1405) when the component is implemented by a composite which has multi service,occur can't find service error.

Posted by "wangfeng (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1405?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12514085 ] 

wangfeng commented on TUSCANY-1405:
-----------------------------------

I look into the code and  found the crux of this problem.

when a component is implemented by a inner composite,the composite service only generate a promoted service named by the prefix of '$promoted$.' on the promoted component but not generate the reference such as self reference.
so when we locate a service which really locate the reference on this component,occur this  service not found error .

I think there are two ways to solve this problem.One is generate the self reference for every promote service on the promoted component,the other way is when locate a service ,we search the reference name not only loop the component's reference,but also loop the component's service.

anyone has better ideas for this?

> 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
>            Assignee: Raymond Feng
>             Fix For: Java-SCA-0.91
>
>         Attachments: ConmpositeImplementation.jar
>
>
> 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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-1405) when the component is implemented by a composite which has multi service,occur can't find service error.

Posted by "wangfeng (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1405?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

wangfeng updated TUSCANY-1405:
------------------------------

    Attachment: ConmpositeImplementation.jar

> 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
>
>         Attachments: ConmpositeImplementation.jar
>
>
> 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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1405) when the component is implemented by a composite which has multi service,occur can't find service error.

Posted by "Raymond Feng (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1405?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12514268 ] 

Raymond Feng commented on TUSCANY-1405:
---------------------------------------

Yes, that's exactly the problem. 

Fix-wise, it's a bit tricky. Maybe adding a self-reference to the promoted service would work. But it needs to be added when the promoted service is created.

> 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
>            Assignee: Raymond Feng
>             Fix For: Java-SCA-0.91
>
>         Attachments: ConmpositeImplementation.jar
>
>
> 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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org