Using JMS resources in Java EE applications

Need help to create your Enterprise Java Beans project? This tip from SAP Developer Network walks you through the process of creating a JMS resources deployment descriptor and implementing the configuration XML schema file.

In the process of developing a Java EE application in any particular Message Driven Bean, you have to perform several tasks.

You need to create an EJB project, where you set up the message driven bean. You also create an Enterprise Application Project (EAR) and the JMS resources xml, where you declare the connection factories and the destinations needed for the application. The jms-resources.xml has to be included in the EAR.

Deploying the EAR file will result in the automatic deployment of all JMS resources defined in the jms-resources.xml file. The XML file will be packaged in the EAR file. Put this XML file under the META-INF directory.

    Creating the JMS resources deployment descriptor
  1. From the META-INF context menu of the MDBEar, choose New, Other, then XML. Choose Next.
  2. Choose Create XML file from an XML schema file and then Next.
  3. Specify the Project, in our example MDBEar, and the META-INF, where you will create the jms-resources.xml and choose Next.
  4. Choose Select XML Catalog entry and select the jms-resources.xsd schema. Choose Next.
  5. Choose Finish.

Implementing the configuration

    Requires Free Membership to View

XML Schema file

To implement the configuration XML Schema file, navigate to META-INF in your Enterprise Application Project and open the jms-resources.xml file. One of the portions of this file sets up
the connection factory and the destination.

Here is how my descriptor looks after adding manually the JMS resources. First, you have to declare the <connection-factory> tag, and afterwards the definition of the destinations.

  1. For Queue destination:
  2. For Topic destination:
  3. Afterward, you can continue developing and deploying your Java EE Application.

    For more information, refer to:

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/55e7d5 1e-0e01-0010-7b84-a95ee55eadeb

Ekaterina Anachkova is an information developer at SAP Labs Bulgaria.

This content is reposted from the SAP Developer Network.
Copyright 2007, SAP Developer Network

SAP Developer Network (SDN) is an active online community where ABAP, Java, .NET, and other cutting-edge technologies converge to form a resource and collaboration channel for SAP developers, consultants, integrators, and business analysts. SDN hosts a technical library, expert blogs, exclusive downloads and code samples, an extensive eLearning catalog, and active, moderated discussion forums. SDN membership is free.

Want to read more from this author? Click here to read Ekaterina Anachkova's Weblog. Click here to read more about Application Servers on SDN.

This was first published in February 2007

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.