Building Tuscany on Linux

This document describes the detailed steps to setup your system, download the Tuscany source code, build the Tuscany runtime and run two SCA samples, a simple J2SE program and a Web application invoking a HelloWorld SCA service.

These instructions have been tested on a RedHat Linux Enterprise 4 system and a Fedora Core 5 system.

System requirements

Creating a tuscany directory

Open a terminal window, then from the shell prompt create a tuscany directory as follows:

mkdir ~/tuscany
cd ~/tuscany

This is the directory where we're going to download the Tuscany code as well as the tools and packages required to build and run Tuscany.

Downloading and installing the Java JDK 5.0

Point your Web browser to http://java.sun.com/j2se/1.5.0/download.jsp.

Select "Download JDK 5.0 Update 6".

Accept the License agreement, then select Linux self-extracting file - jdk-1_5_0_06-linux-i586.bin.

Download jdk-1_5_0_06-linux-i586.bin to the ~/tuscany directory.

From the shell prompt do the following:

chmod +x ./jdk-1_5_0_06-linux-i586.bin
./jdk-1_5_0_06-linux-i586.bin

This will extract the Java JDK 5.0 to tuscany/jdk1_5_0_06.

Modify your user profile ($HOME/.bashrc if you're using bash) and add the following lines:

JAVA_HOME=~/tuscany/jdk1.5.0_06
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH

Downloading and installing Apache Maven 2.0.4

Point your Web browser to http://maven.apache.org/download.html.

Select "Maven 2.0.4 (tar.gz) - maven-2.0.4-bin.tar.gz".

Download maven-2.0.4-bin.tar.gz to the ~/tuscany directory.

From the shell prompt do the following:

tar xzvf maven-2.0.4-bin.tar.gz

This will extract Maven 2.0.4 to the ~/tuscany/maven-2.0.4 directory.

Modify your user profile and add the following lines:

MVN_HOME=~/tuscany/maven-2.0.4
export MVN_HOME
PATH=$MVN_HOME/bin:$PATH

Downloading and installing Apache Ant 1.6.5

Point your Web browser to http://ant.apache.org/bindownload.cgi.

Select ".tar.gz archive: apache-ant-1.6.5-bin.tar.gz".

Download apache-ant-1.6.5-bin.tar.gz to the ~/tuscany directory.

From the shell prompt do the following:

tar xzvf apache-ant-1.6.5-bin.tar.gz

This will extract Ant 1.6.5 to the ~/tuscany/apache-ant-1.6.5 directory.

Modify your user profile and add the following lines:

ANT_HOME=~/tuscany/apache-ant-1.6.5
export ANT_HOME
PATH=$ANT_HOME/bin:$PATH

Downloading and installing Subversion 1.3.0

Note. Fedora Core 5 comes with the subversion 1.3.1 client so you can skip this step.

Point your Web browser to http://subversion.tigris.org/project_packages.html.

Pick a Subversion RPM package for your system, for example for a RedHat Enterprise Linux 4 system pick http://summersoft.fay.ar.us/pub/subversion/latest/rhel-4/bin/subversion-1.3.0-1.rhel4.i386.rpm.

Download subversion-1.3.0-1.rhel4.i386.rpm to the ~/tuscany directory.

From the shell prompt do the following:

su

(you need to be root to install the subversion RPM)

rpm -iv subversion-1.3.0-1.rhel4.i386.rpm

This will install Subversion 1.3.0 on your system.

You can now close your terminal window.

Verifying your setup

Open a new terminal window, then from the shell prompt do the following:

java -version
mvn --version
ant -version
svn --version

You should see the following:

http://people.apache.org/~jsdelfino/wiki/screencaps/linux/verifysetup.jpg

You are now ready to check out the Tuscany source code.

Checking out the Tuscany source code

From the shell prompt, do the following:

cd ~/tuscany
svn co http://svn.apache.org/repos/asf/incubator/tuscany/java

This should check out all the source code from the Tuscany SVN repository into the ~/tuscany/java directory.

When the check out completes, do the following:

cd java
ls -1

You should see the following:

http://people.apache.org/~jsdelfino/wiki/screencaps/linux/verifycheckout.jpg

You are now ready to build the Tuscany runtime.

Building the Tuscany runtime

From the shell prompt do the following:

cd ~/tuscany/java
mvn

This will build the Tuscany runtime with Maven. Maven will download all the JAR dependencies, build all the Tuscany sub-projects and run the unit tests.

When the build completes you should see the following:

http://people.apache.org/~jsdelfino/wiki/screencaps/linux/verifybuild.jpg

Running the HelloWord sample

To run the HelloWorld sample you need to have the following JARs on your Java classpath:

~/.m2/repository/org/osoa/sca-api/SNAPSHOT/sca-api-SNAPSHOT.jar
~/.m2/repository/org/apache/tuscany/tuscany-common/SNAPSHOT/tuscany-common-SNAPSHOT.jar
~/.m2/repository/org/apache/tuscany/tuscany-core/SNAPSHOT/tuscany-core-SNAPSHOT.jar
~/.m2/repository/org/apache/tuscany/tuscany-model/SNAPSHOT/tuscany-model-SNAPSHOT.jar
~/.m2/repository/axis/axis-wsdl4j/1.2/axis-wsdl4j-1.2.jar
~/.m2/repository/commonj/sdo-api/SNAPSHOT/sdo-api-SNAPSHOT.jar
~/.m2/repository/org/apache/tuscany/tuscany-sdo-impl/SNAPSHOT/tuscany-sdo-impl-SNAPSHOT.jar
~/.m2/repository/org/eclipse/emf/ecore/2.2.0-SNAPSHOT/ecore-2.2.0-SNAPSHOT.jar
~/.m2/repository/org/eclipse/emf/common/2.2.0-SNAPSHOT/common-2.2.0-SNAPSHOT.jar
~/.m2/repository/org/eclipse/emf/ecore-change/2.2.0-SNAPSHOT/ecore-change-2.2.0-SNAPSHOT.jar
~/.m2/repository/stax/stax-api/1.0/stax-api-1.0.jar
~/.m2/repository/woodstox/wstx-asl/2.8.2/wstx-asl-2.8.2.jar
~/.m2/repository/org/apache/tuscany/sca/containers/tuscany-container-java/SNAPSHOT/tuscany-container-java-SNAPSHOT.jar

Instead of copying all the JARs by hand, you can use one of the Tuscany build scripts to create a directory containing all the required JARs.

From the shell prompt, do the following:

ant -f ~/tuscany/java/testing/tomcat/build.xml -Dtuscany.acceptance.target.dir=~/tuscany/java/target j2se

This will copy all the required JARs into directory ~/tuscany/java/target/j2se.

From the shell prompt do the following:

ls target/j2se

You should see the following:

http://people.apache.org/~jsdelfino/wiki/screencaps/linux/verifyj2se.jpg

You are now ready to run the Tuscany HelloWorld sample. Do the following:

cd samples/helloworld
java -Djava.ext.dirs=$HOME/tuscany/java/target/j2se -classpath helloworld/target/helloworld-SNAPSHOT.jar org.apache.tuscany.samples.helloworld.HelloWorldClient

This will run the HelloWorld sample application, you should see the following:

http://people.apache.org/~jsdelfino/wiki/screencaps/linux/runhelloworld.jpg

Downloading and installing Tomcat

Point your Web browser to http://www.ibiblio.org/pub/mirrors/apache/tomcat/tomcat-5/v5.5.16/bin/apache-tomcat-5.5.16.tar.gz.

Download apache-tomcat-5.5.16.tar.gz to the ~/tuscany directory.

To install Tomcat, from the shell prompt do the following:

cd ~/tuscany
tar xzvf apache-tomcat-5.5.16.tar.gz

This will extract Tomcat to the ~/tuscany/apache-tomcat-5.5.16 directory.

From the shell prompt do the following:

ant -f java/testing/tomcat/build.xml -Dtuscany.acceptance.tc.dir=~/tuscany/apache-tomcat-5.5.16 tuscany.tomcat.fixup

This will configure Tomcat to use Tuscany and will install all the required JARs under the Tomcat lib directory.

You should see the following:

http://people.apache.org/~jsdelfino/wiki/screencaps/linux/tomcatsetup.jpg

You are now ready to start Tomcat and run the Tuscany HelloWorldWeb sample.

Running the HelloWorldWeb sample

From the shell prompt, do the following:

cp java/samples/helloworld/helloworldweb/target/helloworldWeb-SNAPSHOT.war apache-tomcat-5.5.16/webapps

This will install the HelloWorldWeb sample Web application.

To start Tomcat do the following:

apache-tomcat-5.5.16/bin/startup.sh

This will start Tomcat as a daemon process. You should see the following:

http://people.apache.org/~jsdelfino/wiki/screencaps/linux/starttomcat.jpg

To verify that Tomcat is running, point your Web browser to http://localhost:8080.

You should see the Tomcat home page:

http://people.apache.org/~jsdelfino/wiki/screencaps/linux/tomcathome.jpg

To run the HelloWorldWeb sample Web application, point your Web browser to http://localhost:8080/helloworldWeb-SNAPSHOT.

You should see the following:

http://people.apache.org/~jsdelfino/wiki/screencaps/linux/helloworldweb.jpg

Click the Submit button, this will execute the sample HelloWorld SCA service.

You should see the following:

http://people.apache.org/~jsdelfino/wiki/screencaps/linux/helloworldwebsubmit.jpg

To stop Tomcat, from the shell prompt do the following:

apache-tomcat-5.5.16/bin/shutdown.sh

Tuscany/TuscanyJava/GetTuscany/Linux (last edited 2009-09-20 22:47:59 by localhost)