This is the file created by the Deploy Tool that maps your bean's deployment descriptor (ejb-jar.xml) to actual containers and resources declared in your OpenEJB configuration (openejb.conf). In fact, the Deploy tool really does nothing more than create this file and put it in your jar, that's it.
At startup, any jar containing a openejb-jar.xml is loaded by the container
system. The configuration tools will go looking in all the directories and
jars you have declared in your openejb.conf with the
Nope. Typically you would only use the deploy tool to create your openejb-jar.xml, then just keep your openejb-jar.xml in your CVS (or other repository). If you learn how to maintain this openejb-jar.xml file, you'll never need the deploy tool again! You can do all your builds and deploys automatically.
The openejb-jar.xml file just goes in the META-INF directory of your jar next to the ejb-jar.xml file.
If you can understand the ejb-jar.xml, the openejb-jar.xml should be a breeze.
This is the openejb-jar.xml that is created by the Deploy tool in the Hello World example. As you can see, the file format is extremely simple.
<?xml version="1.0"?>
<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
<ejb-deployment ejb-name="Hello"
deployment-id="Hello"
container-id="Default Stateless Container"/>
</openejb-jar>
The ejb-name attribute is the name you gave the bean in your ejb-jar.xml. The deployment-id is the name you want to use to lookup the bean in your client's JNDI namespace. The container-id is the name of the container in your openejb.conf file that you would like the bean to run in. There MUST be one ejb-deployment element for each EJB in your jar.
Then you simply add a
<?xml version="1.0"?>
<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
<ejb-deployment ejb-name="Hello"
deployment-id="Hello"
container-id="Default Stateless Container" >
<resource-link res-ref-name="jdbc/basic/entityDatabase"
res-id="Default JDBC Database"/>
</ejb-deployment>
</openejb-jar>
The res-ref-name attribute refers to the
You will need one
<?xml version="1.0"?>
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>MyExampleBean</ejb-name>
<home>com.widget.ExampleHome</home>
<remote>com.widget.ExampleObject</remote>
<ejb-class>com.widget.ExampleBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<description>
This is a reference to a JDBC database.
</description>
<res-ref-name>jdbc/myFirstDatabase</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>
This is another reference to a JDBC database.
</description>
<res-ref-name>jdbc/anotherDatabase</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
</enterprise-beans>
</ejb-jar>
Then you would need two
<?xml version="1.0"?>
<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
<ejb-deployment ejb-name="MyExampleBean"
deployment-id="MyExampleBean"
container-id="Default Stateless Container" >
<resource-link res-ref-name="jdbc/myFirstDatabase"
res-id="My Oracle JDBC Database"/>
<resource-link res-ref-name="jdbc/anotherDatabase"
res-id="My PostgreSQL JDBC Database"/>
</ejb-deployment>
</openejb-jar>
This would require two