Flylib.com

Books Software

 
 
 

Basic Deployment Process

Basic Deployment Process

EJBs can be deployed in OC4J using the processes described in Chapter 9.

As a quick review, you'll need to do the following:

  1. Develop and compile the beans.

  2. Create the standard EJB deployment descriptor ( ejb-jar.xml ).

  3. Create the server-specific orion-ejb-jar .xml (optional in some simple cases) to map Java Naming and Directory Interface (JNDI) locations, resource references, and so on.

  4. Optionally package the application into an enterprise archive (EAR) file.

  5. Configure any resources the EJBs will need to access. This may include setting up data sources in data-sources.xml , configuring security, creating JMS destinations for the message-driven beans, creating database tables for entity bean persistence, and so on.

  6. Create an entry in server.xml pointing to the application (whether to an EAR or an exploded directory structure). Optionally, you can use admin.jar or the Application Server Control (ASC) website to deploy the application instead of manually updating server.xml (see Chapters 9 and 18).

Once deployed, you should be able to test the EJBs from web applications (see Chapter 10) or application clients (see Chapter 13).

About orion-ejb-jar .xml

Some very simple EJB applications can be deployed without any special configuration beyond their standard ejb-jar.xml descriptors. However, in most cases, you'll need to map JNDI locations, resource references, EJB references, security settings, and so on in orion-ejb-jar.xml , which is packaged in META-INF/ along with ejb-jar.xml .

This server-specific descriptor does the following:

  • Maps JNDI locations for the EJBs as well as other resources and components they reference.

  • Configures timeouts, pool sizes, and other performance settings.

  • Configures persistence for both stateful session beans and entity beans, in particular, it allows for the mapping of container-managed fields and relationships.

  • Configures finder method queries.

  • Specifies transactional behavior.

  • Configures value-added features, including OR mapping and Active Components for Java (AC4J).

  • Configures role mappings and other security settings.

  • Allows the overriding of environment entries and other elements in ejb-jar.xml .

  • Configures CORBA security settings for EJBs accessed over RMI-IIOP.

The document type declaration (DTD) used for the orion-ejb-jar.xml deployment descriptor can be found on Oracle's website at http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd . The deployment descriptor should always start with a header like this:

<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise
JavaBeans 1.1 runtime//EN"
"http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd">

The overall structure of the deployment descriptor as defined by this DTD is shown in Figure 11-1.

image from book
Figure 11-1: XML-SPY diagram

Overall Structure

The root element <orion-ejb-jar> has two attributes (used internally by the server) and two subelements: one for EJB deployments ( enterprise-beans ), and one for security role mapping ( assembly-descriptor ). The elements are listed in Table 11-1.

Table 11-1: /orion-ejb-jar Elements

Parameter

Description

orion-ejb-jar:deployment-time

Used by server, do not edit.

orion-ejb-jar:deployment-version

Used by server, do not edit.

enterprise-besans

Configures EJBs declared in ejb-jar.xml .

assembly-descriptor

Resolves security settings declared in ejb-jar.xml .