From Tue Feb 02 06:58:22 2010 Return-Path: Delivered-To: Received: (qmail 14060 invoked from network); 2 Feb 2010 06:58:22 -0000 Received: from (HELO ( by with SMTP; 2 Feb 2010 06:58:22 -0000 Received: (qmail 1442 invoked by uid 500); 2 Feb 2010 06:58:21 -0000 Delivered-To: Received: (qmail 1349 invoked by uid 500); 2 Feb 2010 06:58:21 -0000 Mailing-List: contact; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: List-Id: Delivered-To: mailing list Received: (qmail 1340 invoked by uid 99); 2 Feb 2010 06:58:21 -0000 Received: from (HELO ( by (qpsmtpd/0.29) with ESMTP; Tue, 02 Feb 2010 06:58:21 +0000 X-ASF-Spam-Status: No, hits=-1994.1 required=10.0 tests=ALL_TRUSTED,HTML_MESSAGE,MIME_HTML_ONLY,OBFUSCATING_COMMENT X-Spam-Check-By: Received: from [] (HELO ( by (qpsmtpd/0.29) with ESMTP; Tue, 02 Feb 2010 06:58:20 +0000 Received: from (localhost []) by (Postfix) with ESMTP id 0977329A0012 for ; Mon, 1 Feb 2010 22:58:00 -0800 (PST) Date: Tue, 2 Feb 2010 06:58:00 +0000 (UTC) From: To: Message-ID: <> Subject: [CONF] Apache Geronimo v2.2 > Sample applications MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Auto-Submitted: auto-generated

Sample applications

Page edited by Forrest Xia


This topic is organized in the following sections:

Installi= ng as prebuilt plugins

The recommended practice for Geronimo is to set up a workflow using Gero= nimo plugins and maven from development through test and production. To dem= onstrate this, the samples are built into plugins suitable for the Jetty an= d Tomcat Web containers in Geronimo. Many samples require database access.= This is encapsulated into a separate plugin (sample-datasource).


TODO: Demonstrate how to swap databas= es using plugins; see also the roller plugin

In any case, to install samples as plugins you need to build them first.=

For installation you need a Geronimo server with a Web container install= ed, such as the geronimo-jetty-minimal or geronimo-jetty6-javaee5 servers (= or the equivalent Tomcat variations).

Installing through the administrative console

If you are using one of the Java EE 5 server assemblies you can use the = administrative console to install the plugins. Go to the plugins page, push= the Show Plugins button, find the sample(s) you want to install, an= d click Install. Be sure to select only plugins for the Web contain= er you have installed (e.g. jetty plugins for the Jetty web container). An= y necessary dependencies such as the sample-datasource plugin will be insta= lled automatically. There are equivalent command line functions (described= next under Install= ing through GShell) if you are using one of the minimal assemblies that= does not include the administrative console.

Installing t= hrough GShell

For this you can use any Geronimo server such as one of the minimal asse= mblies or even the framework assembly. After starting geronimo, run ./= bin/gsh deploy/list-plugins in another terminal window and fo= llow the instructions. Installing a sample plugin will install the sample-d= atasource plugin and all other dependencies. Alternatively if you build us= ing

mvn clean install -Pit

you can find a server with the sample installed in directories such as


-Pit is currently only available = in the samples branches/2.2 (2.2.1-SNAPSHOT) and trunk (3.0-SNAPSHOT), not = in branches/2.1 (2.1.3-SNAPSHOT) or tags/samples-parent-2.1.2 (2.1.2)

Building from sou= rce

Downloading= the source code

The first time building samples it is required that you build from the t= op level directory. After the initial build, you can do subsequent builds = of specific samples as necessary.

You need svn and maven installed on your system.


Maven v 2.2.1 or later is required fo= r building Geronimo 2.2 samples.

To check out the 2.2 samples:

svn co
parent-2.2/ samples-parent-2.2

Alternatively, you could choose to wo= rk with the active 2.2 branch of samples. This will allow you to work with= the latest changes in samples but will also expose you to a branch that is= under active development and so things may be in flux from day to day:
svn co ranches/2.2 gsamples-2.2

Depending on when you look you may find earlier or released versions of = the samples under samples/branches and samples/tags. You can browse in any= web browser to see what's there. The trunk for samples always contains sa= mples for the highest level version under development https://svn=

Building the samp= les

Build the samples using this command:

mvn clean install

If you run into the "Could not scan m= odule for TLD files...Filename too long" problem when using Windows platfor= m, please check out samples to a short directory (14 characters or less).

There are minimal integration tests to assure that the sample plugins ca= n be installed on the framework server. To run this tests use this command= :

mvn clean install -Pit

The integration tests are not availab= le prior to Geronimo Samples 2.2

Deploying the built samples as Java EE artifacts

With the sample datasource installed as a plugin

After building the sample projects you can find suitable geronimo plans = for a sample <sample> in


(or the equivalent -tomcat directory). For most samples you will ha= ve to install the sample-datasource plugin first. Samples can be deployed = from the administrative console "deploy new" on a suitable server or using = GShell ./bin/gsh deploy/deploy. Note that in this case y= ou have to start with a server with all the required bits already installed= , not the framework server. Since this installation method is not tested a= utomatically it is more likely to be broken than the plugin method.

Maki= ng life even harder for yourself

You can also install the sample datasource as a javaee artifact using th= e plan we generate when building the plugin, install the sample datasource = using the administrative console using the database wizard, and run the sql= by hand rather than relying on the geronimo DBInitializationGBean.<= /p>

Installing the sample datasource as a Java EE artifact

Before you install any sample applications, deploy the org.tranql/tr= anql-connector-derby-embed-xa/1.4/rar connector located in the geronim= o repo at org/tranql/tranql-connector-derby-embed-xa/1.4/tranql-connect= or-derby-embed-xa-1.4.rar with the plan at sample-datasource/targe= t/resources/META-INF/plan.xml using the admin console "deploy new" or = GShell. This will have exactly the same effect as installing the sample-da= tasource plugin.

Installing the sample datasource through the = admin console database wizard

Create a new datasource using the admin console database wizard, selecti= ng the derby-embed-xa type and naming the database "SampleDatabase" and the= datasource "SampleTxDatasource". The admin console will come up with a mo= dule Id different from what the samples need, so you have to map them in va= r/config/ Insert a line like this:


replacing 2.2 with the appropriate sample version and adjusting the righ= t hand side as necessary. Be sure geronimo is stopped when you edit artifa=

Man= ually initializing the database.

Samples that need database connectivity have the database initialized by= default by using a DBInitializationGBean to run an sql script. Alternative= ly here we describe how to initialize the database by hand. In a production= scenario most likely your db will be set up by a DBA rather than either of= these methods.

  1. Remove the DBInitializationGBean from the sample plan
  2. =09
  3. In the console DB Manager page, use the Create DB function to create= a database named SampleDatabase.
  4. =09
  5. In the console DB Manager page select the SampleDatabase in Use DB, = paste the script found in the sql file located in the project (ear or war) = that builds the top level javaee artifact into the text box, and run it. =09
  6. Deploy and run the application using the modified plan.

Maven Generated Site for viewing javadoc or source xref


Geronimo Samples 2.2 release did not = generate the maven site for javadoc and source xref view. Cause Geronimo si= te scheme for 2.2 has some problem.

There is a maven generated site for samples which can be used to view ja= vadoc and source. It can be found here:

Geronimo Samples 2.2

To navigate to javadoc and source code (xref) for each sample do the fol= lowing:

  1. select "Geronimo Samples :: Samples" under Modules in the left-hand = navigation
  2. =09
  3. select a specific sample from the left-hand navigation under Modules=
  4. =09
  5. to view javadoc or source (xref) you must navigate down to a module = that includes source such as a war or ejb. For example, if you are interes= ted in viewing the servlets associated with the bank sample you would choos= e the following modules: =09
    1. under Modules select "Geronimo Samples :: bank"
    2. =09=09
    3. under Modules select "Geronimo Samples :: bank :: WAR"
    4. =09
  6. =09
  7. once you are at a module that contains source you can then select "P= roject Reports" and from the information provided choose either JavaDocs or= Source Xref.

Availabl= e Sample Applications