The openejb-jar.xml Geronimo deployment plan for an EJB JAR is an XML document. It is defined by the openejb-jar-2.0.xsd schema, which can be found in the schema/ subdirectory of the main Geronimo installation directory. The deployment plan for an EJB JAR may be:
Included in the EJB JAR, in which case it should be named META-INF/openejb-jar.xml
Included in an EAR (but outside of the EJB JAR) and referenced by an alt-dd element of the EAR deployment plan (see Section 15.3.2, “Configuring Application Modules”).
Saved as a separate file and provided to the deploy tool when the EJB JAR module is deployed (though this doesn't work when the EJB JAR is in an EAR).
Created from scratch using a JSR-88 configuration tool, in which case the tool manages saving and loading the deployment plan and passing it to the server when the EJB JAR is deployed. For more information on JSR-88 tools see Section 10.6, “JSR-88 Configuration & Deployment Tools”.
The deployment plan should always use the OpenEJB namespace, and it typically requires elements from the Geronimo Naming, Geronimo Security, and Geronimo System namespaces. Additionally, it has a required attribute to identify its configuration name, and an optional attribute to select a parent configuration. A typical EJB deployment plan looks like this:
<?xml version="1.0" encoding="UTF-8"?> <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.0" xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.0" xmlns:security="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.0" xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0" inverseClassloading="false" configId="MyConfigName" parentId="ParentConfigName"> ... </openejb-jar>
The attributes here are:
The main namespace for the deployment plan, which should always be http://www.openejb.org/xml/ns/openejb-jar-2.0
A secondary namespace, used to identify the common elements for resolving EJB references, resource references, and web services references. If any of those need to be resolved in the deployment plan, this attribute should be present, and should be set to http://geronimo.apache.org/xml/ns/naming-1.0
A secondary namespace, used to identify the common elements for security configuration. If there are any security settings in the deployment plan, this attribute should be present, and should be set to http://geronimo.apache.org/xml/ns/security-1.1
A secondary namespace, used to identify the common elements for common libraries and module-scoped services. If there are any of those present in the deployment plan, this attribute should be present, and should be set to http://geronimo.apache.org/xml/ns/deployment-1.0
A secondary namespace, used to identify the common elements for configuring automatic primary key generation for CMP entity beans (such as, using a sequence or auto-increment column). If there are any primary key generators present in the deployment plan, this attribute should be present, and should be set to http://www.openejb.org/xml/ns/pkgen-2.0
A unique name identifying this module. If deployed as a standalone EJB JAR, this name is used to identify the module to the deployment tool (to start, stop, undeploy, or redeploy the EJB JAR).
Identifies the parent configuration for this EJB JAR (the value specified here should match the configId for that module). If deployed as a standalone EJB JAR, this can be used to make the EJB JAR depend on another module such as another standalone EJB JAR or a J2EE Connector (or it should otherwise be omitted or set to the usual parent for J2EE modules, geronimo/j2ee-server/1.0/car). If deployed as part of an EAR this is usually not necessary, as EAR configuration will be the parent of this module.
If set to true, the class loader for the EJB JAR tries to load a class before checking whether the class is available from its parent class loader. If omitted or set to false, the normal (check parent first) class loader delegation behavior is used (for more details, see the ClassLoader API documentation).
The deployment plan for EJBs usually contains:
Security settings indicating which users and roles should be able to access secure EJBs or secure EJB methods
Details to resolve EJB references, resource references, and web services references declared by EJBs in the ejb-jar.xml deployment descriptor. This isn't always necessary for EJB references (which may be resolved using an ejb-link in the ejb-jar.xml) but generally is for the other types of references.
JNDI names for each EJB, used by remote clients attempting to connect to the EJB.
Web Services settings, for session beans exposed as web services.
Database pool, table, column, query, and relationship information for CMP Entity Beans.
JMS mapping information for Message-Driven Beans.
For the simplest EJB JARs these settings may not be required or the defaults may be sufficient, but in most cases the Geronimo EJB deployment plan will need a substantial amount of information.