Wiki Markup |
---|
{scrollbar} |
Anchor | ||||
---|---|---|---|---|
|
Table of Contents for Deployment plans for Geronimo V1.1
- Introduction
- Apache Geronimo v1.1 deployment Plans
- Work out Deployment Plan with Samples (I will include the completed samples here)
- Deploying and Undeploying Simple HelloWorld (war module,web.xml,geronimo-web.xml)
- Deploying and Undeploying AddressBook(JAR containing EJB ,ejb-jar.xml,openejb.xml)
- Discussion
- Conclusion
Introduction
Every service, application , or resource in Geronimo is configured with an xml deployment plan. Deployment plans are the Geronimo version of the J2EE deployment descriptors. They are still XML files based on XML schemas and containing the configuration details for a specific application module. Via the deployment plans you can not only deploy application modules but also other configurations such as a security realm,see the Deploying secure applications and Deploy the LDAP realm sections for further details and examples.
...
Create new database pools and LDAP Realm sections as some examples.This article is organized into the following sections : -
Apache Geronimo v1.1 deployment plans
The following table illustrates the deployment descriptors name and file location for both standard J2EE and Apache Geronimo specific.
File | Standard Deployment Descriptors in the J2EE specification | Apache Geronimo specific Deployment plan |
---|---|---|
Web Application Archive (WAR) | web.xml under the WEB-INF directory | geronimo-web.xml |
Enterprise Web application archive (EAR) | application.xml | geronimo-application.xml |
J2EE Connector resources archive (RAR) | ra.xml | geronimo-ra.xml |
J2EE client application archive (JAR) | client.xml | geronimo-application-client.xml |
JAR containing EJBs | ejb-jar.xml under the META-INF directory | openejb-jar.xml |
Work Out Deployment Plans with Sample
Assumptions
It's assumed that you have installed the either tomcat or the jetty version of Geronimo V1.1 successfully and it is working. Please find the further details to get the software and install it.(need to direct the link to Installation Guide and the User Guide)
Deployment plan for WAR Module
Deploying and Undeploying Helloworld sample.
This section will cover to understand how the deployment plan works for each one of different application modules.
First let's have look at the simple "HelloWorld"example which creates a Web Application Archive (WAR) under the WEB-INF directory and has a geronimo-web.xml as the apache Geronimo specific deployment Plan.
Here are the steps to understand the deployment plan for the "HelloWorld" Example
.Create a folder in called <app_home> in your working directory
2.Open up a new text file and save it as "HelloWorld.jsp" in side the app_home directory
3.Copy and past the following code for the "HelloWorld.jsp" in it.
HelloWorld.jsp
...
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>HelloWorld!</title>
</head>
<body bgcolor="#707DB8">
<h1>
<font face="courier" color="white">
Hello world from GERONIMO V1.1!
</font>
</h1>
<font face="courier" color="white"> ${datetime}</font>
</html>
4.Create a new folder called"WEB-INF" inside the app-home.
5.Open up new text file and save it as "geronimo-web.xml"(use simple letters)and this is the apache geronimo1.1deployment plan for this sample module.
6.Copy and paste the following xml code in that file and save it inside the <app_home\WEB-INF> directcory.
geronimo-web.xml
...
Detailed deployment plans
Each deployment plans will be discussed separately and are available at the following locations: -
- geronimo-web.xml
- geronimo-application.xml
- geronimo-ra.xml
- geronimo-application-client.xml
- openejb-jar.xml
Deployer Tool
...
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
<dep:moduleId>
<dep:groupId>geronimo</dep:groupId>
<dep:artifactId>HelloWorld</dep:artifactId>
<dep:version>1.1</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
</dep:environment>
<context-root>/hello</context-root>
</web-app>
7.Open up a another new text file save it in <app_home\WEB_INF> directory and name it as "web.xml"
8.Copy and Paste the following xml code in it and save.
web.xml
...
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<welcome-file-list>
<welcome-file>HelloWorld.jsp</welcome-file>
</welcome-file-list>
</web-app>
Deployment plan for geronimo-application.xml and openejb-jar.xml
The following sample is an Email address book which covers how to deploy the J2EE Applications on computer running Apache Geronimo V1.1.AddressBook samples has used JSP,Struts EJB and mysql as the data base.Here It's assumed that you have the basic knowledge and experience of playing with EBJ a,JSP and servlets with other application servers.
AddresBook samples use JSP primarily for presentation logic and the HTML code.Servlets form the controller layer of a typical Model-View-Controller(MVC)architecture serve as an interface between the presentation and the model layers.
The three tire architecture and layers are shown in the picture.
Following diagram shows how the code is organized in the application
...
AddressBook
|_org.apache.geronimo.sample.addressbook.ejb
| |_AddressBookEntryBean.java
| |_AddressBookSessionBean.java
|_org.apache.geronimo.sample.addressbook.struts
| |_AddressBookEntryForm.java
| |_CreateEntry.java
| |_EditEntry.java
| |_ListAddress.java
| |_SaveEntry.java
|_org.apache.geronimo.sample.addressbook.pages
| |_EditAddressBook.jsp
| |_footer.jsp
| |_ListAddressBookPage.jsp
| |_navigation.jsp
| |_site-template.jsp
|
|_resource
|_ear
| |_META_INF
| | |_application.xml
| | |_geronimo-application.xml
| |_mysql-plan.xml
| |_tranql-connector-1.0-SNAPSHOT.rar
|
|_ejb
| |_META_INF
| |_openejb-jar.xml
|_merge
| |_README.txt
| |_servlets.xml
| |_servlets-mappings.xml
| |_struts-controller.xml
| |_strust-data-sources.xml
| |_struts-forms.xml
| |_struts-plugins.xml
| |_taglibs.xml
|
|_webapp
|_images
|_pages
|_style
|
|_WEB_INF
| |_classes
| | |_resources
| | |_application.properties
| |_conf
| | |_struts-config.xml
| | |_validation.xml
| |
| |_tld
| |_geronimo-jetty.xml
| |_tiles-defs.xml
| |_validator-rules.xml
|_index.jsp
JSP and Struts
The Struts action classes are in the AddressBook/src/org/apache/geronimo/sample/addressbook/struts directory. The JSPs are in the AddressBook/src/webapp/pages directory.
EJB
Apache Geronimo uses OpenEJB as the EJB container system. The example contains two EJBs:
Container-managed entity EJB
Stateless session EJB
Deploying an Application-Scoped Connection Pool
An Application scoped connection pool is visible only to the application that deployed it.To deploy an application-scoped connection pool,you need to follow these steps.
1.Specify the connector module in the application deployment descriptor.
2.Specify the connector deployment plan in the geronimo-Specfic application deployment descriptor.
3.Package the application EAR.
Specify the the Connector Module in the Application Deployment Descriptor
The Application deployment descriptor(AddressBook/resources/ear/META-INF/application.xml)should define the TranQL connector module,as shown here.
...
<application
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
version="1.4">
<module>
<ejb>addressbook-ejb.jar</ejb>
</module>
<module>
<web>
<web-uri>addressbook.war</web-uri>
<context-root>/addressbook</context-root>
</web>
</module>
<module>
<connector>tranql-connector-1.1.rar</connector>
</module>
</application>
NOTE : It's a must to package the connector RAR file along with the application EAR file.
Specify the Connector Deployment Plan in the Geronimo Application Deployment Descriptor
Specify the connector deployment plan file in the Geronimo application deployment Descriptor(AddressBook/resources/ear/ear/META-INF/geronimo-application.xml)as shown here.
Deployment plan for RAR Module
Deployment plab for JAR containing EJB Module
...