Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
xml
borderStylesolid
titlegeronimo-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" 
         xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" 
         xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" 
         xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
  <sys:environment>
    <sys:moduleId>
      <sys:groupId>org.apache.geronimo.samples</sys:groupId>
      <sys:artifactId>MyPhonebookWeb</sys:artifactId>
      <sys:version>1.0</sys:version>
      <sys:type>car</sys:type>
    </sys:moduleId>
  </sys:environment>
  <context-root>/myphonebook</context-root>
</web-app>

Configuring, Building, and Deploying the Application

Download the MyPhoneBook application from the following link:
MyPhoneBook

After decompressing the given file, the myphonebook directory will be created.

Configuring

Configuration of the application consists of creating the database and defining the connection pool to access it.

Creating and Populating Database

After starting Apache Geronimo log into the console and follow the given steps to create the PhoneBookDB.

Deployment Plan for the application

geronimo-application.xml tells the application that there is a database pool that needs to be deployed as well. The db pool is defined in PhoneBookPool.xml and the driver that is needs in order to be deployed is the tranql-connector-ra-1.3.rar file--these two files will reside on the top level layer of the resultant EAR file.

Code Blockcode
xml
xml
borderStylesolid
titlePhoneBookgeronimo-application.sqlxml
<?xml version="1.0" encoding="UTF-8"?>
<application	xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.1"
				xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
				xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"
				application-name="t6">
    <sys:environment>
        <sys:moduleId>
            <sys:groupId>org.apache.geronimo.samples</sys:groupId>
            <sys:artifactId>MyPhonebook</sys:artifactId>
            <sys:version>1.0</sys:version>
            <sys:type>car</sys:type>
        </sys:moduleId>
    </sys:environment>
    <module>
        <connector>tranql-connector-ra-1.3.rar</connector>
        <alt-dd>PhoneBookPool.xml</alt-dd>
    </module>
</application>

Configuring, Building, and Deploying the Application

Download the MyPhoneBook application from the following link:
MyPhoneBook

After decompressing the given file, the myphonebook directory will be created.

Creating and Populating Database

After starting Apache Geronimo log into the console and follow the given steps to create the PhoneBookDB.

Code Block
xml
xml
borderStylesolid
titlePhoneBook.sql

CREATE TABLE phonebook ( name VARCHAR(CREATE TABLE phonebook ( name VARCHAR(255) PRIMARY KEY, number VARCHAR(255) );
INSERT INTO phonebook VALUES ('John', '1234');
INSERT INTO phonebook VALUES ('Joe', '5678');
  1. Select DB Manager link from the Console Navigation in the left.
  2. Give the database name as PhoneBookDB and click Create button.
  3. Select PhoneBookDB to the Use DB field.
  4. Open PhoneBookDB.sql in the myphonebook directory from a text editor.
  5. Paste the content PhoneBookDB.sql to the SQL Commands text area and press Run SQL button.

Building

...

  1. in the left.
  2. Give the database name as PhoneBookDB and click Create button.
  3. Select PhoneBookDB to the Use DB field.
  4. Open PhoneBookDB.sql in the myphonebook/myphonebook-ear

...

  1. /src/main/resources directory from a text editor.
  2. Paste the content PhoneBookDB.sql to the SQL Commands text area and press Run SQL button.

Building

Use a command prompt to navigate into the myphonebook directory and just give mvn clean install site command to build. It will create the myphonebook-ear-2.0-SNAPSHOT.ear under the myphonebook folder. Now, you are ready to deploy myphonebook application in the Geronimo Application server

...

Deploying the Database Pool

...

.

Deploying the Application

...

  1. Scroll down to Deploy New from the Console Navigation panel.
  2. Load myphonebook-ear-2.0-SNAPSHOT.ear from myphonebook/myphonebook-ear/target folder in to the Archive input box.
  3. Press Install button to deploy application in the server.

...