Apache Tuscany > Home > SCA Overview > SCA Java > SCA Java Work-In-Progress > Federation Notes User List | Dev List | Issue Tracker  

Pulling together notes on what has been build to support federation in the tunk as it stands (just after TSS demo - March 07)

References

Raymond's architecture guide http://cwiki.apache.org/confluence/display/TUSCANY/Tuscany+Architecture+Guide
Some discussions from the dev list about contributio, discovery, federation and the TSS demo:

Building The Demo

From The TSS Tag

Follow instructions in README.txt here http://svn.apache.org/repos/asf/incubator/tuscany/java/distribution/sca/tsss-demo/
Unzip the resulting demo zip file
Meeraj's discussion of switching from JXTA to JSM http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg15731.html
I had problems in that some of the required dependency JARs were missing. I copied:

  • tuscany-jms-discovery-0.1-incubating-SNAPSHOT.jar
  • apache-activemq-4.1.0-incubator.jar
  • tuscany-http-jetty-0.1-incubating-SNAPSHOT.jar
  • jetty-6.1.0.jar
  • jetty-util-6.1.0.jar
  • tuscany-sca-console-0.1-incubating-SNAPSHOT.jar
  • geronimo-j2ee-connector_1.5_spec-1.0.jar

into each of the profiles boot directories

Manually From Head

I couldn't get this to work as the core tests now fail

Debugging The Demo

When run originally the demo complained about missing dependencies. In particular when reading the system components (root.system) I got the error:

org.apache.tuscany.host.runtime.InitializationException: org.apache.tuscany.spi.
component.GroupInitializationException: sca://root.system/main
at org.apache.tuscany.core.runtime.AbstractRuntime.initialize(AbstractRu
ntime.java)
at org.apache.tuscany.standalone.server.TuscanyServer.startRuntime(Tusca
nyServer.java:134)

What this actually means is that Tuscany failed to load one of the system components successfully but, by default, doesn't tell what the issue is. I wanted to use Eclipse to debug it so I played about a bit but couldn't get the java -jar command line to come up in the Eclipse debugger. As a fall back I started a remote debugging session. There were three steps to this.

Add a trap to the code to give me a chance to attach the debugger. I added the following lines to the mainline of the:

 System.out.println("press a key");
 java.io.BufferedReader stdin = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
 String line = stdin.readLine();

Start java app with remote debugging enabled. There are plenty of references on the web on how to do this. Here is the comman line I used to start the master profile.

java -Xrunjdwp:server=y,transport=dt_socket,address=4142,suspend=n -Dtuscany.adminPort=2000 -jar server.start.jar ma
ster

When the app comes up and stops at the trap connect the Eclipse debugger by selecting the remote debugging profile and specifying localhost:4142 as the connection details. The port number (4142) just comes from that specified on the application command line.

Turning Logging On

Its not clear how to do this just yet. Meeraj suggests that the missing nested exception detail can be printed out by specifying a log formatter. TODO.

Running The Demo

(From Meeraj's post on the subject)
This is how you start the servers (Please make sure you start ActiveMQ
before you start the servers) .

Master: java -Dtuscany.adminPort=2000 -jar server.start.jar master
Slave1: java -Dtuscany.adminPort=3000 -jar server.start.jar slave1
Slave2: java -Dtuscany.adminPort=4000 -jar server.start.jar slave2

You can access the admin console from http://localhost:7000/scdlForm and
if you target the deployed SCDL to slave1, access the demo appilcation
from http://localhsot:8000/calculatorForm. The test scdl is as follows
(this is what you submit from the admin console to target a deployment
to a slave),

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
          xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
          name="CalculatorComposite">

   <component runtimeId="slave1" name="CalculatorServiceComponent">
       <implementation.java class="calculator.CalculatorServiceImpl"/>
       <reference name="addService" target="AddServiceComponent"/>
       <reference name="subtractService"
target="SubtractServiceComponent"/>
       <reference name="multiplyService"
target="MultiplyServiceComponent"/>
       <reference name="divideService"
target="DivideServiceComponent"/>
   </component>

   <component runtimeId="slave1" name="AddServiceComponent">
       <implementation.java class="calculator.AddServiceImpl"/>
   </component>

   <component runtimeId="slave1" name="SubtractServiceComponent">
       <implementation.java class="calculator.SubtractServiceImpl"/>
   </component>

   <component runtimeId="slave1" name="MultiplyServiceComponent">
       <implementation.java class="calculator.MultiplyServiceImpl"/>
   </component>

   <component runtimeId="slave1" name="DivideServiceComponent">
       <implementation.java class="calculator.DivideServiceImpl"/>
   </component>

</composite>

Here is the actual sequence of events:

Start ActiveMQ

java -Dtuscany.adminPort=2000 -jar server.start.jar master
java -Dtuscany.adminPort=3000 -jar server.start.jar slave1
java -Dtuscany.adminPort=4000 -jar server.start.jar slave2

Each of these just reports "Started" on the command line

Go to http://localhost:7000/scdlForm in a browser and paste in the SCDL from above to configure slave1 to create and wire the calculator components.

Go to http://localhsot:8000/calculatorForm in a browser and see the form that drives the calculator sample. Type in a couple of numbers and press Add.

website stats