...
This document is organized in the following sections:
Table of Contents |
---|
XML Schemas
Java EE Deployment Plans
Module Type | Geronimo Schema | Preferred Java EE Schema |
---|---|---|
General (Tomcat or Jetty) Web Application (WAR) | ||
Tomcat-Only Web Application (WAR) | ||
Jetty-Only Web Application (WAR) | ||
EJB (JAR) | ||
J2EE Connector (RAR) | ||
Application Client (JAR) | http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0 | |
Application (EAR) |
Common Elements & Configuration
Module Type | Geronimo Schema | Description |
---|---|---|
Server Plans & Common Elements | Used to deploy new services in Geronimo in a standalone plan, and also contains common elements used by many other plans. | |
Geronimo Plugin Descriptor | Metadata on a Geronimo plugin or a list of available Geronimo plugins. | |
Security Mapping | Common security elements used by other plans. | |
Security Realms | Abbreviated syntax for configuring security realm and login module GBeans. You can either manually configure multiple GBeans or declare a single GBean for the realm using this to configure all the login modules. | |
Naming | Common elements for references to other components (EJBs, database pools, JMS resources, J2EE Connectors, Web Services, etc.) | |
Primary Key Generator | Abbreviated syntax for configuring primary key generators for CMP entity beans. Avoids manually configuring and wiring up PK generator GBeans. | |
CORBA CSS Configuration | Abbreviated syntax for configuring security for clients accessing remote EJBs via CORBA. | |
CORBA TSS Configuration | Abbreviated syntax for configuring security for EJBs exposed via CORBA. | |
config.xml | The format of the | |
Tomcat Web App Configuration | If you use the generic ( | |
Jetty Web App Configuration | If you use the generic ( |
Configurations
In this section, we will discuss about the configurations that are already deployed and running in the server when the server is installed and started.
Connection pools
Apache geronimo ships with embedded derby database and activemq message broker. There are also connection pools that connect to derby and activemq configured to run in the installed server. The following sections discuss about various such configurations already running in the installed server.
Embedded Derby Database connection pool
Apache Geronimo ships with embedded derby database. The derby libraries are present in the server repository at <geronimo_home>/repository/org/apache/derby
. By default, a derby database by name SystemDatabase
is created and the files related to the database are stored at <geronimo_home>/var/derby/SystemDatabase
. Along with that, by default, server deploys a database connection pool over the SystemDatabase
with the configuration name org.apache.geronimo.configs/system-database/2.1/car
. The name of the database connection pool is SystemDatasource
. The configuration artifacts are stored at <geronimo_home>/repository/org/apache/geronimo/configs/system-database
. The deployment plan used for database connection pool is as follows.
...
Closely observe various configurations in the deployment plan. Many derby libraries in the server repository are mentioned as dependencies. After configuring the outbound resource adapter, there are series of gbeans configured for the database connection pool.
Embedded ActiveMQ resource adapter
By default, a JMS resource adapter that connects to embedded activemq message broker is deployed and running in the apache geronimo server. This is an outbound jms resource adapter that configures a connection factory and two message queues. The configuration name of the resource adapter is org.apache.geronimo.configs/activemq-ra/2.1/car
. The artifacts of the resource adapter are stored at <geronimo_home>/repository/org/apache/geronimo/configs/activemq-ra
. The deployment plan is as follows.
...
The resource adapter used to deploy the above plan is <geronimo_home>/repository/org/apache/geronimo/modules/geronimo-activemq-ra/2.1
. After the server is started, the running resource adapter can be looked up on the admin console from Console Navigation => Services => JMS Resource
. We can also observe the connection factories and queues deployed by the resource adapter on the admin console.
Security
A Java EE application may consist of several components that can be deployed into different containers such as WEB container, EJB container, WebServices container in a JEE5 server. This kind of deployment allows multi-tier applications that interact with one another to perform a given user task. Multi-tier JEE5 applications can be secured by properly selecting authenticating mechanisms and designing authorization levels or roles. If the application components use declarative security management, the authentication and authorization aspects are declared in corresponding JEE5 deployment descriptors. The declared security roles or levels are mapped to real security roles or levels in the geronimo deployment plans through security realms. In Apache Geronimo , the security realms abstract away authentication and authorization aspects of the application components. The authentication and authorization together enable access control for the various components of the application.
...
For example, Geronimo uses geronimo-admin security realm to authenticate users when they login to the geronimo administration Console. The deployment plan of the security realm is follows.
geronimo-admin security realm
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2"> <environment> <moduleId> <groupId>console.realm</groupId> <artifactId>geronimo-admin</artifactId> <version>1.0</version> <type>car</type> </moduleId> <dependencies> <dependency> <groupId>org.apache.geronimo.framework</groupId> <artifactId>j2ee-security</artifactId> <type>car</type> </dependency> </dependencies> </environment> <gbean name="geronimo-admin" class="org.apache.geronimo.security.realm.GenericSecurityRealm" xsi:type="dep:gbeanType" xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <attribute name="realmName">geronimo-admin</attribute> <reference name="ServerInfo"> <name>ServerInfo</name> </reference> <xml-reference name="LoginModuleConfiguration"> <log:login-config xmlns:log="http://geronimo.apache.org/xml/ns/loginconfig-2.0"> <log:login-module control-flag="REQUIRED" wrap-principals="false"> <log:login-domain-name>geronimo-admin</log:login-domain-name> <log:login-module-class> org.apache.geronimo.security.realm.providers.PropertiesFileLoginModule </log:login-module-class> <log:option name="groupsURI">var/security/groups.properties</log:option> <log:option name="usersURI">var/security/users.properties</log:option> </log:login-module> </log:login-config> </xml-reference> </gbean> </module> |
...
Once a security realm is deployed, it is available for any JEE5 application deployed in Geronimo to map declared roles to actual users/groups through a Geronimo specific deployment plan.
Applications
An enterprise application archive (EAR) can consist of several application modules. The application modules can be several web application archives (WAR) , EJB modules (JAR), application client modules (JAR) or resource archive modules (RAR). User can either deploy these modules individually or bundle them into a single EAR file and deploy that file.
...
JEE module | JEE deployment descriptor (DD) | Geronimo deployment plan |
---|---|---|
web application archive (WAR) | | |
EJB application archive (JAR) | | |
resource adapter archive (RAR) | | |
enterprise application archive (EAR) | | |
enterprise application client archive (JAR) | |
Web Application deployment plan
In the geronimo-web.xml
file, application deployer maps the security roles, ejb names, database resources, JMS resources, etc. declared in web.xml
to corresponding entities deployed in the server. In addition to that, if there are any web container specific configurations, such as Tomcat or Jetty specific, depending on the application needs, all these settings are configured as well here. If the web application depends on any third party libraries or other services running in the server, all these dependencies are declared in the plan. Some web applications require class loading requirements different from the default class loading behavior. The geronimo-web.xml
allows application deployer to configure this as well. There are many more configurations that could be done through geronimo-web.xml
depending on the needs of web application. The following sections briefly explain how geronimo-web.xml
can be used to configure the web container and web applications.
The geronimo-web.xml
uses XML elements from http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1 namespace and one or more namespaces mentioned in Common elements and Configuration section earlier in the document.
...
All the XML schema files are located at <geronimo_home>/schema
directory. Please go through the .xsd
files to have a feel of XML tags that can be used in geronimo-web.xml
for configuring web applications.
EJB Application deployment plan
Geronimo uses OpenEJB container for providing ejb services. With the advent of JEE 5, the ejb container services such as transaction management, security, life cycle management can be declared in the ejb class itself using annotations. However, the ejb deployment descriptor can still be provided through ejb-jar.xml
file. When both annotations and ejb-jar.xml
file are provided, the ejb-jar.xml
file takes precedence over the annotations.
...
The above descriptor and plan are the simple illustrations that explain how ejb modules are developed and assembled for Apache Geronimo. Similarly, many other configurations can be performed in the openejb-jar.xml
. The schema for the plan is openejb-jar-2.1.xsd
Enterprise application deployment plan
An enterprise application archive (EAR
) can consist of many sub modules. The sub modules can be web modules (WAR
), ejb modules (JAR
), resource adapter modules (RAR
) or application client modules (jar
). When an EAR
consist of many sub modules, the deployment plans for all the sub modules can be provided in a single file named geronimo-application.xml
. This single file contains the deployment details of each of the sub modules of the EAR
. Alternatively, each of the sub modules can package its corresponding deployment plan file within itself. However, the preferable way is to provide a single deployment plan through geronimo-application.xml
for all the sub modules. This mechanism provides flexibility of allowing us to modify the deployment configuration for all modules through a single file. In this section, we explore EAR
deployment plan and understand what it contains.
...
The moduleId Order/OrderEAR/5.0/car
is the configuration for the Order.ear
. The ejb module declares a dependency on the console.dbpool/OrderDS/1.0/rar
configuration in <sys:dependencies>
section. This is the moduleId of the database pool that connects to the DB2 database where the order details are stored.
JEE Application Client deployment plan
JEE application client modules run in client container and also have access to server environment. Usually, JEE client applications are created to administer the running enterprise applications in the server. Client modules run in a separate JVM and connect to enterprise application resources but have access to all the application resources in standard JEE way.
...
The following commands illustrates the deployment and running of the client module.
No Format bgColor #000000 borderStyle solid
C:\\Geronimo-2.1\bin>deploy.bat --user system --password manager deploy C:\temp\ConverterEJBClient.jar
Using GERONIMO_BASE: C:\Geronimo-2.1
Using GERONIMO_HOME: C:\Geronimo-2.1
Using GERONIMO_TMPDIR: var\temp
Using JRE_HOME: C:\JDK\jre
Deployed Converter/Converter-app-client-server/3.0/jar
C:\Geronimo-2.1\bin>java -Djava.endorsed.dirs="C:\Geronimo-2.1\lib\endorsed" -jar
C:\Geronimo-2.1\bin\client.jar Converter/Converter-app-client/3.0/jar 4000
Rs 4000.0 is 100.0 Dollars.
Message Driven Bean deployment plan.
Apache geronimo ships with ActiveMQ message broker and an inbound and outbound JMS resource adapter for the ActiveMQ broker. This sample illustrates deploying and running two MDBs that listen to a jms topic TextTopic
. When the web client publishes a message to this topic, the two MDBs receive the message and process it. Because the message is published to the topic, all the configured listeners, in this case the two MDBs, receive a copy of the message. In addition to that, we will also illustrate how to deploy a JMS resource adapter within the application scope. Usually, the resource adapters are deployed at the server scope and can be used by all other applications as well. In this example, a JMS resource plan is embedded in the application deployment plan geronimo-application.xml
and deployed while deploying the application archive.
...