OpenEJB Deploy Tool

|  |  |  | OpenEJB OpenJMS OpenORB Castor Tyrex |

Main
Welcome!
Download
Mailing Lists
The Team

Users
Quickstart
Hello World!
CMP Example
CMP Guide
Deploy
Startup
Validation
Configuration
Support
Request Feature
FAQ

Servers
Local Server
Remote Server
Tomcat

Integrators
Why OpenEJB
Overview
Design
Specification
Presentation

Developers
Custom Services
Release Plan
Source Code
SourceForge

OpenEJB Deploy Tool

## NAME

openejb deploy - OpenEJB Deploy Tool

## SYNOPSIS

openejb deploy [options] jarfiles

## NOTE

The OpenEJB Deploy tool is an OPTIONAL tool that creates the openejb-jar.xml file required for your bean to be loaded into the container system at startup. If you want to create or maintain that openejb-jar.xml file yourself, you don't need the Deploy tool at all. For more information, see the openejb-jar.xml FAQ

The OpenEJB Deploy tool must be executed from the OPENEJB_HOME directory. This is the directory where OpenEJB was installed or unpacked. For for the remainder of this document we will assume you unpacked OpenEJB into the directory C:\openejb.

In Windows, the deploy tool can be executed as follows:

C:\openejb> openejb deploy -help

In UNIX, Linux, or Mac OS X, the deploy tool can be executed as follows:

[user@host openejb]# ./openejb.sh deploy -help

Depending on your OpenEJB version, you may need to change execution bits to make the scripts executable. You can do this with the following command.

[user@host openejb]# chmod 755 openejb.sh bin/*.sh

From here on out, it will be assumed that you know how to execute the right openejb script for your operating system and commands will appear in shorthand as show below.

openejb deploy -help

## DESCRIPTION

The OpenEJB Deploy Tool is responsible for linking or "hooking up" your beans to the container system. It is run as a separate command line tool using the data in your OpenEJB configuration file (C:\openejb\conf\openejb.conf). The next time the system is started, all the deplpoyed beans will be loaded.

In the OpenEJB configuration file (C:\openejb\conf\openejb.conf), there are a number of containers and resources defined. Each of these has a unique name and will be loaded at start up with that name. In order for your beans to be loaded into the container system, they must also be named. This name is called a Deployment ID and must be completely unique in comparison to all other beans across all jars loaded into the container system.

Furthermore, the system must also know which which container to put a given bean into. During deployment, the bean's Deployment ID must be mapped to a Container ID.

If the beans has any references to database or other resources using the <resource-ref> tag in the jar's META-INF/ejb-jar.xml, those references must be resolved and linked to a resource declared in the openejb.conf.

All this information is collected by the OpenEJB Deploy Tool. Using the Deploy Tool will cause a new file to be added to your jar, META-INF/openejb-jar.xml. Jars in the deployments path containing a META-INF/openejb-jar.xml file will be loaded when the system starts up and will be usable at runtime. Any jar containing an invalid openejb-jar.xml, or conntaining no openejb-jar.xml at all, will simply be overlooked by the container system.

To effectively "undeploy" a jar, you simply need to remove the META-INF/openejb-jar.xml file from the jar then restart the container system/server. If you wish to temporarily remove the jar from the container system, you can just rename the jar with a new extention, ".skip" for example, then restart the container system/server.

The files passed to the Deploy Tool must be valid ejb 1.1 jar files and contain the META_INF/ejb-jar.xml inside the jar. This is case sensitive, so meta-inf/Ejb-Jar.xml is not the same as META_INF/ejb-jar.xml.

Do NOT edit the openejb-jar.xml file unless you know exactly what you are doing.

## OPTIONS

| -m |  | Move the jar to the OPENEJB_HOME/beans directory. Will not overwrite the jar if there is an existing jar with the same name in the OPENEJB_HOME/beans directory. Add the -f option to force the overwrite.
| -c |  | Copy the jar to the OPENEJB_HOME/beans directory. Will not overwrite the jar if there is an existing jar with the same name in the OPENEJB_HOME/beans directory. Add the -f option to force the overwrite.
| -f |  | Forces a move or a copy, overwriting any previously existing jar with the same name.
| -a |  | Automate deployment as much as possible. Applies all automation related flags.
| -C |  | Automatically assigns each bean in the jar to the first container of the appropriate bean type.
| -D |  | Automatically assigns the OpenEJB Deployment ID for each bean by using the <ejb-name> in your ejb-jar.xml. The deployment ID uniquely identifies the bean in the OpenEJB container system and is used by most servers as the client-side JNDI name. No two beans can share the same deployment ID.
| -d | dir | Sets the OPENEJB_HOME to the specified directory.
| -l | file | Sets the log4j configuration to the specified file.
| -conf | file | Sets the OpenEJB configuration to the specified file.
| -version |  | Print the version.
| -help |  | Print this help message.
| -examples |  | Show examples of how to use the options.

## EXAMPLES

### Deploying multiple jar files

openejb deploy myapp\fooEjbs.jar myapp\barEjbs.jar

Deploys the beans in the fooEjbs.jar first, then deploys the beans in the barEjbs.jar. Wildcards can be used as well.

openejb deploy myapp\*.jar

### Using -m

openejb deploy -m myapp\myEjbs.jar

Deploys the beans in the jar, moving the entire jar from myapp\myEjbs.jar to OPENEJB_HOME\beans\myEjbs.jar.

If the jar OPENEJB_HOME\beans\myEjbs.jar already existed, it will not be overwritten. Supply the -f to force an overwrite.

openejb deploy -m -f myapp\myEjbs.jar

### Using -c

openejb deploy -c myapp\myEjbs.jar

Same as using -m, except the jar is copied not moved. The -f also can be used with a -c to force an overwrite if the file is already present.

### Using -C

openejb deploy -C myapp\myEjbs.jar

Deploys the beans in the jar, does not prompt you to assign each bean to a container. Instead, each bean will automatically be assigned to the first container of the appropriate type.

### Using -D

openejb deploy -D myapp\myEjbs.jar

Deploys the beans in the jar, does not prompt you to assign each bean a Deployment ID. Instead, the deployment ID for each bean will automatically be assigned using the <ejb-name> of the bean as it is in the META-INF/ejb-jar.xml of the jar file.

The deployment ID uniquely identifies the bean in the OpenEJB container system. No two beans can share the same deployment ID.

The deployment ID is also used by most servers as the client-side JNDI name for doing JNDI lookups.

### Using -a

openejb deploy -a myapp\myEjbs.jar

Applies all automation related flags. Currently equivalent to:

openejb deploy -C -D myapp\myEjbs.jar

As more automation options are added, they will also be applied when using the -a option.

### Using -d dir

openejb deploy -d C:\openejb myapp\myEjbs.jar

Sets the OPENEJB_HOME to the C:\openejb directory. This will cause the deploy tool to treat the C:\openejb as the directory where OpenEJB was installed.

### Using -conf file

openejb deploy -conf C:\openejb\conf\mytest.conf myapp\myEjbs.jar

Sets the openejb.configuration system variable to the file C:\openejb\conf\mytest.conf. When the beans are deployed the beans will be to be mapped to the containers and resources in the configuration file C:\openejb\conf\mytest.conf. If the deploy tool needs update the configuration, the mytest.conf file will be modified.

### Using combinations of options

openejb deploy -c -a C:\foo\bar.jar D:\my\beans\*.jar

openejb deploy -c -C /foo/bar.jar

openejb deploy -m -a /home/dblevins/mybeans/*.jar

openejb deploy -D -m /home/dblevins/mybeans/*.jar

openejb deploy -a /openejb/beans/*.jar

openejb deploy -a C:\openejb\beans\*.jar

Java, EJB, JDBC, JNDI, JTA, Sun, Sun Microsystems are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and in other countries. XML, XML Schema, XSLT and related standards are trademarks or registered trademarks of MIT, INRIA, Keio or others, and a product of the World Wide Web Consortium. All other product names mentioned herein are trademarks of their respective owners.