Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current Restore this Version View Page History

« Previous Version 9 Next »

Introduction

Fabric3 is a platform for developing, assembling, and managing distributed applications. Fabric3 provides the following features:

  • A programming model based on Service Component Architecture (SCA) that is specifically designed for building and integrating loosely-coupled systems.
  • The ability to use a variety of remote communication protocols in a unified, consistent manner without tying application logic to specific transport APIs.
  • A cross-application policy framework for implementing and enforcing policies such as security and SLAs throughout an organization.
  • A management framework for provisioning, controlling, and monitoring production deployments.
  • Portability across a variety of middleware environments including Tomcat, and WebLogic.
  •  

In this chapter, we cover the basics of setting up and deploying an application using Fabric3. 


The documentation assumes a basic understanding of SCA concepts. Before proceeding, if you have not done so, we recommend familiarizing yourself with SCA. The specifications themselves (http://www.oasis-opencsa.org) are generally not the most accessible source of introductory information. We recommend:

The Samples


The Fabric3 samples are organized as follows:

  • Starter: Contains several variations of a calculator application that show how to create services, wire them, and expose them as a web services endpoint and REST resource.
  • Features: Contains applications that demonstrate how to use specific Fabric3 features, including JPA/Hibernate, pub/sub eventing, websockets, timers, and custom policies.
  • Apps. Contains complete applications that demonstrate SCA and Fabric3 best-practices. There is currently one application, BigBank.


For projects that intend to use Spring, Fabric3 also ships with a set of dedicated Spring samples. These samples are ports of the SCA Java samples described in this chapter, with SCA Java components replaced by Spring beans. Basic layout, configuration and deployment remain the same across both sets of samples.

Prerequisites


The samples may be downloaded from http://www.fabric3.org/downloads and require the following software:


Note that it is not necessary to download the Fabric3 runtime distribution in addition to the samples as the sample build process will automatically download a distribution and configure a Fabric3 runtime cluster. 

Building and Deploying The Starter Applications


The starter calculator applications are the recommended way to get familiar with Fabric3. To build and deploy the calculator applications, do the following:

  • Build the starter modules.

In the directory where you extracted the samples distribution, go to the /starter project folder and execute: 

{code{color:#333333}} mvn clean install

 


Note internet access is required the first time the project is built so Maven can download the required project dependencies. Remote access can be turned off for subsequent builds by executing: 

mvn -o clean install


JARs containing the application artifacts will be created in the /target output directories for each application.
* Build the Fabric3 server distribution.

Download the Fabric3 standalone runtime by executing the Maven build script from the samples /servers/vm directory:
mvn -o clean install



This will create a server image for use with the samples in the /target/image directory.  Note the server is configured to run as a single instance. The /servers/cluster directory contains modules which will configure a multi-cluster Fabric3 installation. The starter applications can be deployed to either topology.
* Start the server. 

To launch a Fabric3 server in single-VM mode, execute the following from the /bin directory /servers/vm/target/image by executing:
java -jar server.jar


Alternatively, the Fabric3 server can be started from another working directory by executing:
java -jar <path to bin directory>server.jar


* Deploy the application.

After the server has booted, deploy a calculator application archive by copying it to the Fabric3 runtime /deploy directory.
The runtime will write a message to the console after the war has been deployed. Depending on the application deployed, one of the following will be available.
* The web calculator UI can be accessed at http://localhost:8181/ calculator/entry.html.

* The REST calculator resource can be accessed using a GET with the formula to calculate included in the URI as in: http://localhost:8181/calculator/1+1

* The web services calculator can be accessed at http://localhost:8181/calculator and its WSDL from http://localhost:8181/calculator?wsdl.

The samples also contain a separate client for the web services calculator. The client module is located at /samples/wscalc-client. The WSCalcClient class can be executed using the Java command line or via an IDE.

h1. Building and Deploying BigBank

To build and deploy BigBank, do the following:
* Build the BigBank source.

To build BigBank, go to the bigbank project folder and execute:
mvn clean install


The build will produce two archives: bigbank-loan-1.7.jar (the server module) and bigbank-client-1.7.jar (the web service client)
* Start the server.

Boot the Fabric3 runtime from the server/vm/image/bin directory by executing:
java -jar server.jar


* Deploy the archives.

Copy bigbank-loan-1.7.jar to the runtimes/vm/deploy directory.
* Deploy and Execute the client applications

BigBank includes a web application front-end and loan officer web application. Note both web applications currently do not support Internet Explorer. Please use FireFox, Chrome, or Safari.
Copy bigbank-web-1.7.jar and bigbank-backoffice-1.7.jar to the runtimes/vm/deploy directory.

Deploying BigBank to a Distributed Domain


The samples distribution also contains an automated build process for producing a set of clustered servers. To create the clustered servers, execute the following from the servers/cluster directory:
mvn clean install


The build will create three server images located in the target directory of each module under /servers/cluster: controller, zone1, and zone2.
Follow the steps in the previous section to build the BigBank application. When the build completes, launch the H2 database, controller and zone runtimes:

  1.  
  • Launch the shared H2 database process from cluster/database:


java -jar target/h2-1.2.140.jar



  • From the controller/target/image/bin directory:

java -jar server.jar controller


  • From the zone1/target/image/bin directory:

java -jar server.jar participant


  1.  
  • From the zone2/target/image/bin directory:

java -jar server.jar participant

After booting, the runtimes will discover each other and form a distributed domain consisting of two cluster zones. Note the runtimes may be on the same machine or different machines.
Copy bigbank-loan-1.7.jar to the controller/target/image/runtimes/controller/deploy directory. The controller will provision the loan service to zone1 and the backend services to zone2.
To run additional zone participants, copy one of the images and follow the instructions above for launching the servers. If more than one server is run on the same machine, you will need to modify the HTTP and HTTPS ports in config/participant/systemConfig.xml.

Getting Help


At some point you may require help with Fabric3. The best place to obtain pointers, advice or assistance troubleshooting a problem is the user mailing list, which can be accessed at {+}http://xircles.codehaus.org/projects/fabric3/lists+. There are several mailing lists for Fabric3. Please post questions to the user list. The developer list is intended for topics related to ongoing Fabric3 development and is not a general forum for questions. However, if you are interested in Fabric3 development, we encourage you to participate in discussions.
Should you encounter a bug, we encourage you to file a report in the online JIRA system at {+}http://jira.codehaus.org/browse/FABRICTHREE+. If possible, please include a detailed description and failing testcase (or other appropriate means) to reproduce the problem. Assisting Fabric3 developers in reproducing the problem generally leads to faster resolution.