tuscany-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hinde Bouziane <hbouz...@irisa.fr>
Subject Re: [Fwd: get a reference to a domain from a remote program]
Date Wed, 02 Jul 2008 12:46:06 GMT
Hi Simon and Raymond,

Thank you very much for your help.

I'm trying to apply the solution Simon suggested as in our case we 
prefer to keep component services definitions unchanged (anyway, thanks 
Raymond).
One idea to resolve the problem is to expose a service (as a web 
service) by the domain manager from which it may be possible to have a 
global vision of available services/created components (like a naming 
service). Otherwise, in a distributed manner, the same principle can be 
applied to nodes rather than components insides nodes.
If I find another possible way, I'll post it.

However, I'm facing now a problem that seems to be not related to usage 
of additional components. The problem is the following:

I encounter an error when a component (belonging to a first node) tries 
to access a service provided by another component (belonging to a second 
node): This later is not found and I don't understand why.

The scenario is the following:
I launch a node (Let us name it NodeA) in which there is a component 
(ComponentA) with two references (refA1, refA2), each reference has to 
be connected to a service provided by a component (ComponentB) defined 
inside another node (NodeBC). In NodeBC, there are two components 
ComponentB and ComponentC.


When I launch NodeBC, first, the domain displays the Warning :

Jul 2, 2008 12:32:00 PM 
org.apache.tuscany.sca.workspace.admin.impl.ContributionCollectionImpl get
INFO: get http://tuscany.apache.org/cloud
Jul 2, 2008 12:32:00 PM 
org.apache.tuscany.sca.workspace.admin.impl.DeployableCompositeCollectionImpl$1 
problem
WARNING: Component reference target not found, it might be a remote 
service: ComponentB
Jul 2, 2008 12:32:00 PM 
org.apache.tuscany.sca.workspace.admin.impl.DeployableCompositeCollectionImpl$1 
problem
WARNING: Component reference target not found, it might be a remote 
service: ComponentB

The same warning appears when I launch NodeA, so of course when 
ComponentA try to access a remote service, an exception is thrown: 
Target fault type cannot be resolved: null

In order to check if I'm wrong somewhere in my application. To try to 
resolve the problem step by step, I produced a close scenario starting 
from the calculator-distributed sample. I put AddServiceComponentB and 
SubtractServiceComponentC inside a same node NodeBC. Here are changed 
.xml files:
------------------
...resources/nodeBC/Calculator.composite
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
           targetNamespace="http://sample"
           xmlns:sample="http://sample"
           name="CalculatorBC">

    <component name="AddServiceComponentB">
        <implementation.java class="calculator.AddServiceImpl" />
    </component>

    <component name="SubtractServiceComponentC">
        <implementation.java class="calculator.SubtractServiceImpl" />
    </component>
   
</composite>

domain.composite
<composite name="domain.composite"
  targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
  xmlns="http://www.osoa.org/xmlns/sca/1.0" 
xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0">
  <include name="ns2:CalculatorA" uri="nodeA" xmlns:ns2="http://sample"/>
  <include name="ns2:CalculatorBC" uri="nodeBC" xmlns:ns2="http://sample"/>
</composite>

workspace.composite

<workspace xmlns="http://tuscany.apache.org/xmlns/sca/1.0" 
xmlns:ns1="http://tuscany.apache.org/xmlns/sca/1.0">
  <contribution location="file:./src/main/resources/nodeA"  uri="nodeA"/>
  <contribution location="file:./src/main/resources/nodeBC"  
uri="nodeBC"/> 
  <contribution location="file:./src/main/resources/cloud" 
uri="http://tuscany.apache.org/cloud"/> 
</workspace>

cloud.composite

<composite name="cloud.composite"
  targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
  xmlns="http://www.osoa.org/xmlns/sca/1.0" 
xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0">
  <include name="ns2:NodeA" uri="http://tuscany.apache.org/cloud" 
xmlns:ns2="http://sample/cloud"/>
  <include name="ns2:NodeBC" uri="http://tuscany.apache.org/cloud" 
xmlns:ns2="http://sample/cloud"/>
</composite>

--------------------------

I have no problem to launch NodeBC, the domain does not display any 
warning but I have the same problems when I launch the application from 
NodeA:

ant runNodeA
Buildfile: build.xml

runNodeA:
     [java] Jul 2, 2008 1:54:04 PM 
org.apache.tuscany.sca.node.launcher.NodeLauncherUtil collectJARFiles
     [java] INFO: Runtime classpath: 93 JARs from 
/local/hbouzian/PostDoc/src/sca/tuscany-sca-1.2-incubating/modules
     [java] Jul 2, 2008 1:54:04 PM 
org.apache.tuscany.sca.node.launcher.NodeLauncherUtil collectJARFiles
     [java] INFO: Runtime classpath: 148 JARs from 
/local/hbouzian/PostDoc/src/sca/tuscany-sca-1.2-incubating/lib
     [java] Jul 2, 2008 1:54:04 PM 
org.apache.tuscany.sca.node.impl.NodeImpl <init>
     [java] INFO: Creating node: http://localhost:9990/node-image/NodeA
     [java] Jul 2, 2008 1:54:05 PM 
org.apache.tuscany.sca.node.impl.NodeImpl <init>
     [java] INFO: CompositeURL : 
http://localhost:9990/composite-resolved/composite:nodeA;http://sample;CalculatorA 
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     [java] Jul 2, 2008 1:54:05 PM 
org.apache.tuscany.sca.node.impl.NodeImpl configureNode
     [java] INFO: Loading contribution: 
file:/local/hbouzian/PostDoc/src/sca/tuscany-sca-1.2-incubating/samples/calculator-distributedTry2composites/./src/main/resources/nodeA/
     [java] Jul 2, 2008 1:54:06 PM 
org.apache.tuscany.sca.node.impl.NodeImpl configureNode
     [java] INFO: Loading composite: 
http://localhost:9990/composite-resolved/composite:nodeA;http://sample;CalculatorA
     [java] Jul 2, 2008 1:54:07 PM 
org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl$1 problem
     [java] WARNING: Component reference target not found, it might be a 
remote service: AddServiceComponentB
     [java] Jul 2, 2008 1:54:07 PM 
org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl$1 problem
     [java] WARNING: Component reference target not found, it might be a 
remote service: SubtractServiceComponentC
     [java] Jul 2, 2008 1:54:07 PM 
org.apache.tuscany.sca.node.impl.NodeImpl start
     [java] INFO: Starting node: http://localhost:9990/node-image/NodeA
     [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 
processor
     [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 
processor
     [java] CalculatorService - add 3.0 and 2.0
     [java] Exception in thread "main" 
org.osoa.sca.ServiceRuntimeException: 
org.osoa.sca.ServiceRuntimeException: Target fault type cannot be 
resolved: null
     [java]     at 
node.LaunchCalculatorNodeA.main(LaunchCalculatorNodeA.java:64)
     [java] Caused by: org.osoa.sca.ServiceRuntimeException: Target 
fault type cannot be resolved: null
     [java]     at 
org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:134)
     [java]     at 
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:286)
     [java]     at 
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:154)
     [java]     at $Proxy6.add(Unknown Source)
     [java]     at 
calculator.CalculatorServiceImpl.add(CalculatorServiceImpl.java:56)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
     [java]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:597)
     [java]     at 
org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:109)
     [java]     at 
org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
     [java]     at 
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:286)
     [java]     at 
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:154)
     [java]     at $Proxy5.add(Unknown Source)
     [java]     at 
node.LaunchCalculatorNodeA.main(LaunchCalculatorNodeA.java:46)
     [java] Caused by: org.apache.axis2.AxisFault: toto
     [java]     at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
     [java]     at 
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:195)
     [java]     at 
org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)
     [java]     at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:327)
     [java]     at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:206)
     [java]     at 
org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)
     [java]     at 
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374)
     [java]     at 
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
     [java]     at 
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
     [java]     at 
org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invokeTarget(Axis2BindingInvoker.java:118)
     [java]     at 
org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invoke(Axis2BindingInvoker.java:89)
     [java]     at 
org.apache.tuscany.sca.binding.sca.axis2.impl.Axis2SCABindingInvoker.invoke(Axis2SCABindingInvoker.java:104)
     [java]     at 
org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:78)
     [java]     ... 14 more
     [java] Caused by: java.net.UnknownHostException: toto
     [java]     at 
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
     [java]     at 
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
     [java]     at java.net.Socket.connect(Socket.java:519)
     [java]     at java.net.Socket.connect(Socket.java:469)
     [java]     at java.net.Socket.<init>(Socket.java:366)
     [java]     at java.net.Socket.<init>(Socket.java:240)
     [java]     at 
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:79)
     [java]     at 
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:121)
     [java]     at 
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:706)
     [java]     at 
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1321)
     [java]     at 
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386)
     [java]     at 
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
     [java]     at 
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
     [java]     at 
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
     [java]     at 
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:520)
     [java]     at 
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:191)
     [java]     ... 25 more
     [java] Java Result: 1


Can you please tell me if I'm wrong in the way I have to define 
references-services connections when services belong to nodes including 
several components?

Thank you very much.
regards
Hinde.

Simon Laws wrote:
>
>
> On Mon, Jun 30, 2008 at 4:24 PM, Hinde Bouziane <hbouzian@irisa.fr 
> <mailto:hbouzian@irisa.fr>> wrote:
>
>
>
>
>     ---------- Forwarded message ----------
>     From: Hinde Bouziane <hbouzian@irisa.fr <mailto:hbouzian@irisa.fr>>
>     To: dev@tuscany.apache.org <mailto:dev@tuscany.apache.org>
>     Date: Wed, 25 Jun 2008 19:08:21 +0200
>     Subject: get a reference to a domain from a remote program
>     Hi all,
>
>     In the context of a distributed application, I would like to find
>     an existing domain from a program to be able to use services
>     provided by components created in already launched nodes.
>     For more details:
>     1) I use the DomainManagerLauncher interface to launch a domain.
>     2) I use  the  node2-launcher module to launch nodes (in the same
>     way as done in calculator-distributed). Let's suppose that one
>     node contains a component A.
>     - Until now, I had no problem to starts nodes.
>     3) Now, from a program (that as a role of a client) I try to use a
>     service provided by component A. For that, I want to find a
>     reference to the domain created in 1) to asks for  the wanted service.
>
>     I'm using the 1.2 distribution. I found the SCADomainFinder class
>     that offers the getSCADomain operation in the node-api. It seems
>     that this operation  provides a way to find an existing domain,
>     but seems also be not completely implemented (a todo comment ).
>      Is it the case? or is the usage of this operation is not
>     compatible with the usage of node2... modules?  Otherwise, is
>     there another way to find and get the reference to the domain?
>
>     Thank you for your help.
>     Regards,
>     Hinde
>
>
> Hi Hinde
>
> The SCADomainFinder feature is being removed from our next release 
> (1.3) as it's not compatible with the Node2 implementation. What you 
> could do is create a composite containing a component that references 
> component A, let's call is AReference. If you then start a Node2 
> Instance configured to load the composite containing AReference you 
> can then use the SCAClient API on Node2 to get a reference to 
> AReference and the domain will ensure that the AReference component is 
> connected to the A component wherever that is running. A bit clunky 
> but we haven't yet rebuilt the client API for the new domain 
> implementation. Any thoughts about how we should do this are most welcome.
>
> Simon


Mime
View raw message