NAME
openejb deploy - OpenEJB Deploy Tool
SYNOPSIS
openejb deploy #options <file> <file>...
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 can be executed from any directory as long as <OPENEJB_HOME>/bin is in the system PATH. <OPENEJB_HOME> 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-3.0.0.
In Windows, the deploy tool can be executed as follows:
C:\openejb-3.0.0> bin\openejb deploy -help
In UNIX, Linux, or Mac OS X, the deploy tool can be executed as follows:
user@host openejb-3.0.0# bin/openejb 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-3.0.0# chmod 755 bin/openejb
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 deployed 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 containing 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,2.0,2.1 or 3.0 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
-d, --debug |
Increases the level of detail on validation errors and deployment summary. |
--dir |
Sets the destination directory where the app will be deployed. The default is <OPENEJB_HOME>/apps/ directory. Note when changing this setting make sure the directory is listed in the openejb.xml via a <Deployments dir=""/> tag or the app will not be picked up again on restart. |
-conf file |
Sets the OpenEJB configuration to the specified file. |
-h, --help |
Lists these options and exit. |
-o, --offline |
Deploys the app to an offline server by copying the archive into the server's apps/ directory. The app will be deployed when the server is started. The default is online. |
-q, --quiet |
Decreases the level of detail on validation and skips the deployment summary. |
-s, --server-url <url> |
Sets the url of the OpenEJB server to which the app will be deployed. The value should be the same as the JNDI Provider URL used to lookup EJBs. The default is 'ejbd://localhost:4201'. |
-v, --version |
Prints the OpenEJB version and exits. |
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
OUTPUT
On running the deploy tool with a valid EJB jar the following output is printed on the console
Application deployed successfully at {0} App(id=C:\samples\Calculator-new\hello-addservice.jar) EjbJar(id=hello-addservice.jar, path=C:\samples\Calculator-new\hello-addservice.jar) Ejb(ejb-name=HelloBean, id=HelloBean) Jndi(name=HelloBean) Jndi(name=HelloBeanLocal) Ejb(ejb-name=AddServiceBean, id=AddServiceBean) Jndi(name=AddServiceBean) Jndi(name=AddServiceBeanLocal)
Note: In the above case the command used is C:\samples\Calculator-new>openejb deploy hello-addservice.jar
.
This contains two EJBs AddServiceBean and HelloBean.