Starter Applications
The starter calculator applications contained in the Getting Started samples (download) are the recommended way to get familiar with Fabric3. The starter applications are three different variations on a calculator service: the first is exposed as a Web application, the second as a JAX-RS resource and the third as a WS-* Web Service. The calculator service itself is composed of a main component wired to four services that perform basic arithmetic operations:
To build and deploy the calculator applications, do the following:
1. Build the sample modules
In the directory where you extracted the samples distribution, execute:
mvn clean install
.
Under the /starter
project folder, JARs containing the application artifacts will be created in the /target
output directories for each sample application module.
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
This will also create a server image for use with the samples in the server/target/image directory
.
3. Start the server
To launch a Fabric3 server in single-VM mode, execute the following from the server/target/image/bin
directory:
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
It may be necessary to run Fabric3 with larger heap settings than the JVM defaults. To do so, use the standard JVM command line parameters, e.g.:
java -Xmx1024M -jar server.jar
4. Deploy the application
After the server has booted, deploy a calculator application archive by copying it to the Fabric3 runtime server/target/image/runtimes/vm/deploy
directory. The runtime will write a message to the console after the archive has been deployed. Depending on the application deployed, one of the following endpoints 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.