...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?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 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 | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
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'); |
- Select DB Manager link from the Console Navigation in the left.
- Give the database name as PhoneBookDB and click Create button.
- Select PhoneBookDB to the Use DB field.
- Open PhoneBookDB.sql in the myphonebook directory from a text editor.
- Paste the content PhoneBookDB.sql to the SQL Commands text area and press Run SQL button.
Building
...
- in the left.
- Give the database name as PhoneBookDB and click Create button.
- Select PhoneBookDB to the Use DB field.
- Open PhoneBookDB.sql in the myphonebook/myphonebook-ear
...
- /src/main/resources directory from a text editor.
- 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
...
- Scroll down to Deploy New from the Console Navigation panel.
- Load myphonebook-ear-2.0-SNAPSHOT.ear from myphonebook/myphonebook-ear/target folder in to the Archive input box.
- Press Install button to deploy application in the server.
...