Creating Deployment Descriptors for Message-Driven Beans


By using resource injection and annotations, you avoid having to create a standard ejb-jar.xml deployment descriptor file for a message-driven bean. However, in certain situations you still need a deployment descriptor specific to the Application Server, in the file sun-ejb-jar.xml.

You are likely to need a deployment descriptor if the message-driven bean will consume messages from a remote system. You use the deployment descriptor to specify the connection factory that points to the remote system. The deployment descriptor would look something like this:

   <sun-ejb-jar>      <enterprise-beans>        <ejb>          <ejb-name>MessageBean</ejb-name>          <mdb-connection-factory>            <jndi-name>jms/JupiterConnectionFactory</jndi-name>          </mdb-connection-factory>        </ejb>      </enterprise-beans>    </sun-ejb-jar>


The ejb element for the message-driven bean contains the following:

  • The ejb-name element contains the package name of the bean class.

  • The mdb-connection-factory element contains a jndi-name element that specifies the connection factory for the bean.

For an example of the use of such a deployment descriptor, see An Application Example That Consumes Messages from a Remote Server (page 1146).



The JavaT EE 5 Tutorial
The JavaT EE 5 Tutorial
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 309

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net