Hi, The idea is that SCA contributions can be hosted anywhere that can be accessed by URLs, for example, a FTP site, a HTTP server, a SVN repo, a Maven repo or a file system. There are many ways to publish the contributions depending on the repo types, for example, HTTP POST, AtomPub, WebDAV, FTP, SVN commit, Maven deploy.
Thanks, Raymond From: Malte Marquarding Sent: Tuesday, July 29, 2008 6:09 PM To: [email protected] Subject: Re: calculator-distributed on multiple hosts Hi Simon, thanks for this. I guess what I am asking - as I am just coming back to java - is how can I "publish" the contributions' jar without doing it manually. I don't want to use a "contribution location="file://" style url, but have the jar made avaliable somewhere under - in this example - http://<hostname>:9990/. Cheers, Malte. On Tue, Jul 29, 2008 at 6:16 PM, Simon Laws <[EMAIL PROTECTED]> wrote: On Tue, Jul 29, 2008 at 5:25 AM, Malte Marquarding <[EMAIL PROTECTED]> wrote: Hi, I had a look at it myself. I now understand that I can set the url in 'workspace.xml' - RTFM . How do I package/deploy contribution as a jar file. Or should I leave this to you by submitting a JIRA? Cheers, Malte On Sat, Jul 26, 2008 at 12:17 AM, Simon Laws <[EMAIL PROTECTED]> wrote: On Fri, Jul 25, 2008 at 2:59 PM, Simon Laws <[EMAIL PROTECTED]> wrote: On Fri, Jul 25, 2008 at 6:33 AM, Malte Marquarding <[EMAIL PROTECTED]> wrote: Also, why doesn't it look it up in the jar? I edited the ant script to include the path and remove the src directory, but that didn't help. Cheers, Malte. On Fri, Jul 25, 2008 at 2:49 PM, Malte Marquarding <[EMAIL PROTECTED]> wrote: Hi, I made some progress. The problem is that the 'nodeB' composite file is looked up with an absolute path of server1 location of the file on server2. I hope you know what I mean. I found this by moving both server1 and server2 code into '/tmp' - the same location. Now the example runs happily. Shouldn't the file look up be relative. This seems to be a bug. Cheers, Malte. On Fri, Jul 25, 2008 at 10:10 AM, Malte Marquarding <[EMAIL PROTECTED]> wrote: Hi Simon, that's exactly what I did the very first time I tried this (before asking for help). I do get the same exception with respect ro FileNotFound on Host1 (server running domain). This is what the domain log says [java] Jul 25, 2008 10:03:53 AM org.apache.tuscany.sca.workspace.admin.impl.CompositeImageCollectionImpl doGet [java] INFO: get NodeB [java] Jul 25, 2008 10:03:53 AM org.apache.tuscany.sca.workspace.admin.impl.DeployedCompositeCollectionImpl getAll [java] INFO: getAll [java] Jul 25, 2008 10:03:53 AM org.apache.tuscany.sca.workspace.admin.impl.DeployableCompositeCollectionImpl get [java] INFO: get composite:http://tuscany.apache.org/cloud;http://sample/cloud;NodeA [java] Jul 25, 2008 10:03:53 AM org.apache.tuscany.sca.workspace.admin.impl.ContributionCollectionImpl get [java] INFO: get http://tuscany.apache.org/cloud [java] Jul 25, 2008 10:03:53 AM org.apache.tuscany.sca.workspace.admin.impl.DeployableCompositeCollectionImpl get [java] INFO: get composite:http://tuscany.apache.org/cloud;http://sample/cloud;NodeB [java] Jul 25, 2008 10:03:53 AM org.apache.tuscany.sca.workspace.admin.impl.ContributionCollectionImpl get [java] INFO: get http://tuscany.apache.org/cloud [java] Jul 25, 2008 10:03:53 AM org.apache.tuscany.sca.workspace.admin.impl.DeployableCompositeCollectionImpl get [java] INFO: get composite:http://tuscany.apache.org/cloud;http://sample/cloud;NodeC [java] Jul 25, 2008 10:03:53 AM org.apache.tuscany.sca.workspace.admin.impl.ContributionCollectionImpl get [java] INFO: get http://tuscany.apache.org/cloud [java] Jul 25, 2008 10:03:53 AM org.apache.tuscany.sca.binding.atom.provider.AtomBindingListenerServlet doGet [java] INFO: >>> FeedEndPointServlet /composite-image/ [java] Jul 25, 2008 10:03:53 AM org.apache.tuscany.sca.workspace.admin.impl.CompositeImageCollectionImpl query [java] INFO: query composite=composite:nodeB;http://sample;CalculatorB [java] Jul 25, 2008 10:03:53 AM org.apache.tuscany.sca.workspace.admin.impl.ContributionCollectionImpl query [java] INFO: query alldependencies=nodeB Cheers, Malte On Fri, Jul 25, 2008 at 2:14 AM, Simon Laws <[EMAIL PROTECTED]> wrote: On Tue, Jul 22, 2008 at 12:53 AM, Malte Marquarding <[EMAIL PROTECTED]> wrote: Hi Simon, I did the following Host 1: ant runDomain Host 2: I modified in my case the NodeB launcher to run in the remote location. I get an exception because it can find the artefacts ant runDomain ant runNodeB [java] INFO: Loading contribution: file:/Users/me/java/tuscany-sca-1.2.1-incubating/samples/calculator-distributed/./src/main/resources/nodeB/ [java] 22/07/2008 09:21:53 org.apache.tuscany.sca.node.launcher.NodeLauncherUtil node [java] SEVERE: SCA Node could not be created [java] java.lang.reflect.InvocationTargetException [java] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [java] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [java] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [java] at java.lang.reflect.Constructor.newInstance(Constructor.java:494) [java] at org.apache.tuscany.sca.node.launcher.NodeLauncherUtil.node(NodeLauncherUtil.java:297) [java] at org.apache.tuscany.sca.node.launcher.NodeLauncher.createNode(NodeLauncher.java:60) [java] at org.apache.tuscany.sca.node.launcher.NodeLauncher.main(NodeLauncher.java:109) [java] at node.LaunchCalculatorNodeB.main(LaunchCalculatorNodeB.java:26) [java] Caused by: org.osoa.sca.ServiceRuntimeException: java.io.FileNotFoundException: /Users/me/java/tuscany-sca-1.2.1-incubating/samples/calculator-distributed/./src/main/resources/nodeB (No such file or directory) This directory is present on the remote domain (host 1) ls /Users/me/java/tuscany-sca-1.2.1-incubating/samples/calculator-distributed/./src/main/resources/nodeB 8 Calculator.composite 0 META-INF/ What else am I missing? Cheers, Malte. On Mon, Jul 21, 2008 at 9:20 PM, Simon Laws <[EMAIL PROTECTED]> wrote: On Mon, Jul 21, 2008 at 9:40 AM, Malte Marquarding <[EMAIL PROTECTED]> wrote: Hi, Thanks that works. Does that mean you are running two domains? This is exactly what I stumbled over. I remote domain manger would certainly be good. Cheers, Malte On Mon, Jul 21, 2008 at 3:06 PM, Luciano Resende <[EMAIL PROTECTED]> wrote: The calculator-distributed already runs in multiple VM. Let me describe the steps I had to do in order to run the sample in two different machines. In one of the machine, I ran NodeB and NodeC by doing the following : ant runDomain ant runNodeB ant runNodeC In the other machine, I ran NodeA that would connect to the remote nodes (nodeB and NodeC). I have to modify the node composites, to properly identify the remote uri for the nodes as follow : <component name="NodeB"> <t:implementation.node uri="nodeB" composite="s:CalculatorB"/> <service name="Node"> <binding.sca uri="http://tuscany1.domain.com:8200"/> </service> </component> <component name="NodeC"> <t:implementation.node uri="nodeC" composite="s:CalculatorC"/> <service name="Node"> <binding.sca uri="http://tuscany1.domain.com:8300"/> </service> </component> Then I ran nodeA : ant runDomain ant runNodeA The only thing I'm not sure is how I would tell the node to connect to a remote domain manager, that would simplify the steps to run nodeA. On Sun, Jul 20, 2008 at 6:41 PM, Malte Marquarding <[EMAIL PROTECTED]> wrote: > Hi, > any takers? I tried the API docs, but they are outdated - JIRA submitted and > trying to build from source. > Cheers, > Malte -- Luciano Resende Apache Tuscany Committer http://people.apache.org/~lresende http://lresende.blogspot.com/ Hi In the case of samples/calculator-distributed the node launchers are hard coded to talk to the domain at "http://localhost:9990". If you look in each of the node launcher classes you will see lines like... NodeLauncher.main(new String[] {"http://localhost:9990/node-config/NodeC"}); To run the domain in a remote location change the localhost here to the host where the domain is running or write some launcher code that takes this URL as a parameter. The launcher for nodeA is slightly different from the launchers for B and C in that it goes on to make the test calls but in all these cases it wouldn't be hard to change to accept the domain configuration URL as a command line argument. If you decide to give this a go make a patch and we can update the sample. Regards Simon Hi Malte Sorry this is such a late reply. I just didn't notice this come through. You may have got past this now but anyhow.... You don't need to do "ant runDomain" on Host2. Your changes to the NodeB launcher should point it at the domain running on Host1. Hence you don't need the domain running on Host2. Just the NodeB runs on Host2. Regards Simon Hi Malte This sounds like a bug to me. Can you raise a JIRA for it (http://issues.apache.org/jira/browse/TUSCANY) and lets see if we can get it fixed. Thanks Simon Hi Malte A bit more information. I've just been trying this and I do see the problem you see when running across machines. The strange file read exception you are seeing occurs because the domain is trying to provide the remote node (NodeB) with a file system based contribution. When you run the node the configuration URL (http://9.20.188.196:9990/node-config/NodeB) is used to ask the domain for two things. 1 - the composite that is configured by the domain to represent the correct domain configuration. The actual result here is that all the service and reference URIs are filled in based on where each node is to be deployed using information from the node.composite files. 2 - the contributions that are required to provide the artifacts needed to run the composite at this node This sample has been written to work directly from the file system so that it's straightforward to edit and recompile. However this does cause the problem that you are seeing as the domain cannot provide a file system based contribution out to the remote node. What we need to do to make this work across nodes is package each nodes contribution as a jar. So please go ahead and raise a JIRA and I'll look at it as it seems natural to want to try the calculator distributed in a distributed environment. Regards Simon Hi Malte There's nothing particularly special about a contribution packaged as a jar. It can simply just be any old jar file. There are some SCA specific things you may find in a contribution, and hence in a contribution packaged as a jar, such as a ".composite" file or a "META-INF/sca-contribution.xml" file. A good place to look for an example is the store tutorial. Here the store application is built up by deploying a number of jar based contributions. You can see the "store" contribution at [1]. You can see the way that the domain is build up at [2]. There are quite a lot of contributions here as the application is presented in a number of different configurations for tutorial purposes [3] Regards Simon [1] http://svn.apache.org/repos/asf/tuscany/java/sca/tutorials/store/store/ [2] http://svn.apache.org/repos/asf/tuscany/java/sca/tutorials/store/domain/ [3] http://svn.apache.org/repos/asf/tuscany/java/sca/tutorials/store/Tutorial.pdf
