ow it's time to create the deployment descriptor. As a
reminder, this file tells the EJB server which classes form the Bean, the home
interface and the remote interface. If there is more than one Bean in the
package, it indicates also how the Beans interact with one another. In this
simple example, there is only one Bean so we won't need to worry about that
part.
Most commercial EJB servers are supplied with graphical tools for constructing
the deployment descriptor. jBoss does have an XML editor, but it's just as easy
to construct the deployment descriptor manually. Here it is:
ejb-jar.xml: deployment descriptor for the Interest Bean
<?xml version="1.0" encoding="Cp1252"?>
<ejb-jar>
<description>jBoss test application</description>
<display-name>Test</display-name>
<enterprise-beans>
<session>
<ejb-name>Interest</ejb-name>
<home>com.web_tomorrow.interest.InterestHome</home>
<remote>com.web_tomorrow.interest.Interest</remote>
<ejb-class>com.web_tomorrow.interest.InterestBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
The deployment descriptor must be called ejb-jar.xml, and it must
be in the directory ./META-INF. A common mistake is to name this
directory `META_INF' (with an underscore, rather than a dash), which won't
work.
<ejb-name>Interest</ejb-name>assigns a name to the Bean; in practice client applications won't use this name, they will use the Bean's JNDI name, which is assigned in a different file. The JNDI name will often be in the form `[application name]/[bean name]', which is what we shall use later.
jboss.xml in the same directory as the deployment descriptor.
The format of jboss.xml is largely undocumented, but it's
straightforward. The first part of the file lists the Beans and their JNDI
names, and refers to configuration sections in the second part of the file. It
should only be necessary to edit the first part. In the listings below I have
divided the jboss.xml file into two parts to make the distinction
clear; of course you need both these parts in the same file in practice.
jboss.xml: first part (this bit provided by the Bean developer)
<jboss>
<enterprise-beans>
<session>
<ejb-name>Interest</ejb-name>
<jndi-name>interest/Interest</jndi-name>
<configuration-name>Defaugt Stateless SessionBean</configuration-name>
</session>
<secure>false</secure>
</enterprise-beans>
All this file says is that the Bean called Interest is assigned
the JNDI name of interest/Interest and has the server
configuration Defaugt Stateless SessionBean. This configuration
refers to a section in the second part of the file. I don't know in detail what
this section does, and I don't particularly want to! Here it is, anyway:
jboss.xml: second part (this bit should not need to be edited)
<resource-managers />
<container-configurations>
<container-configuration configuration-class="org.jboss.ejb.deployment.EntityContainerConfiguration">
<container-name>BMP EntityBean</container-name>
<container-invoker>org.jboss.ejb.plugins.jrmp13.server.JRMPContainerInvoker</container-invoker>
<instance-pool>org.jboss.ejb.plugins.EntityInstancePool</instance-pool>
<instance-cache>org.jboss.ejb.plugins.NoPassivationEntityInstanceCache</instance-cache>
<persistence-manager>org.jboss.ejb.plugins.BMPPersistenceManager</persistence-manager>
<transaction-manager>org.jboss.tm.TxManager</transaction-manager>
<container-invoker-conf>
<Optimized>False</Optimized>
</container-invoker-conf>
<container-cache-conf />
<container-pool-conf>
<MaximumSize>100</MaximumSize>
<MinimumSize>10</MinimumSize>
</container-pool-conf>
</container-configuration>
<container-configuration configuration-class="org.jboss.ejb.deployment.StatelessSessionContainerConfiguration">
<container-name>Singleton Stateless SessionBean</container-name>
<container-invoker>org.jboss.ejb.plugins.jrmp13.server.JRMPContainerInvoker</container-invoker>
<instance-pool>org.jboss.ejb.plugins.SingletonStatelessSessionInstancePool</instance-pool>
<instance-cache></instance-cache>
<persistence-manager></persistence-manager>
<transaction-manager>org.jboss.tm.TxManager</transaction-manager>
<container-invoker-conf>
<Optimized>False</Optimized>
</container-invoker-conf>
</container-configuration>
<container-configuration configuration-class="org.jboss.ejb.deployment.EntityContainerConfiguration">
<container-name>CMP EntityBean</container-name>
<container-invoker>org.jboss.ejb.plugins.jrmp13.server.JRMPContainerInvoker</container-invoker>
<instance-pool>org.jboss.ejb.plugins.EntityInstancePool</instance-pool>
<instance-cache>org.jboss.ejb.plugins.NoPassivationEntityInstanceCache</instance-cache>
<persistence-manager>org.jboss.ejb.plugins.jaws.JAWSPersistenceManager</persistence-manager>
<transaction-manager>org.jboss.tm.TxManager</transaction-manager>
<container-invoker-conf>
<Optimized>False</Optimized>
</container-invoker-conf>
<container-cache-conf />
<container-pool-conf>
<MaximumSize>100</MaximumSize>
<MinimumSize>10</MinimumSize>
</container-pool-conf>
</container-configuration>
<container-configuration configuration-class="org.jboss.ejb.deployment.StatelessSessionContainerConfiguration">
<container-name>Defaugt Stateless SessionBean</container-name>
<container-invoker>org.jboss.ejb.plugins.jrmp13.server.JRMPContainerInvoker</container-invoker>
<instance-pool>org.jboss.ejb.plugins.StatelessSessionInstancePool</instance-pool>
<instance-cache></instance-cache>
<persistence-manager></persistence-manager>
<transaction-manager>org.jboss.tm.TxManager</transaction-manager>
<container-invoker-conf>
<Optimized>False</Optimized>
</container-invoker-conf>
<container-pool-conf>
<MaximumSize>100</MaximumSize>
<MinimumSize>10</MinimumSize>
</container-pool-conf>
</container-configuration>
</container-configurations>
</jboss>
So now we've got the deployment descriptor ejb-jar.xml, the
run-time configuration file jboss.xml and the classes. It's time
to package them together.
©1994-2003 Kevin Boone, all rights reserved