Skip Headers
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g (10.1.3.5.0)

Part Number E13981-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

Configuring an Environment Reference to a JMS Destination or Connection Resource Manager Connection Factory (JMS 1.0)

You can access a JMS destination (queue or topic) and JMS connection resource manager connection factory by creating an environment reference to them using deployment XML (see "Using Deployment XML").

Note:

In EJB 3.0, an environment reference to a resource manager connection factory is not needed. You can access a resource manager connection factory directly using annotations and resource injection (see "Looking Up an EJB 3.0 Resource Manager Connection Factory").

For information on looking up a resource manager connection factory, see the following:

Using Deployment XML

To define a reference to a JMS destination and JMS connection resource manager connection factory, do the following:

  1. Configure your JMS service provider.

    For more information, see the following:

  2. Define the JNDI name for the JMS destination and connection factory.

    For more information, see the following:

  3. Define a logical name for the JMS destination and JMS connection factory:

    How you define the logical names is the same regardless of what type of JMS provider you use.

    1. Define a <resource-env-ref> element in the appropriate client deployment descriptor (see "Where do you Configure an EJB Environment Reference?") and configure the following subelements:

      • <resource-env-ref-name>: a logical name for the JMS destination resource manager connection factory.

      • <resource-env-ref-type>: The destination class type; either javax.jms.Queue or javax.jms.Topic.

      Example 19-13 shows a <resource-env-ref> element for a JMS topic resource manager connection factory.

      Example 19-13 <resource-env-ref> for a JMS Topic Destination

      <resource-env-ref>
        <resource-env-ref-name>rpTestTopic</resource-env-ref-name>  
        <resource-env-ref-type>javax.jms.Topic</resource-env-ref-type>
      </resource-env-ref>
      
    2. Define a <resource-ref> element in the same client deployment descriptor and configure the following subelements:

      • <res-ref-name>: a logical name for the JMS connection resource manager connection factory.

      • <res-type>: the connection factory class type; either javax.jms.QueueConnectionFactory or javax.jms.TopicConnectionFactory.

      • <res-auth>: the authentication responsibility; either Container or Bean.

      • <res-sharing-scope>: the sharing scope; either Shareable or Unshareable.

      Example 19-14 shows a <resource-ref> element for a JMS topic connection resource manager connection factory.

      Example 19-14 <resource-ref> for a JMS Topic Connection Factory

      <resource-ref>
        <res-ref-name>myTCF</res-ref-name>
        <res-type>javax.jms.TopicConnectionFactory</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
      </resource-ref>
      
  4. Map the logical names to the actual JNDI names.

    1. Define a <resource-env-ref-mapping> element in the corresponding OC4J-specific deployment descriptor (see "Where do you Configure an EJB Environment Reference?") and configure its name attribute to the JMS destination logical name (defined in the <resource-env-ref>), and its location attribute–to the JNDI name defined when you configured your JMS provider (see step 2).

      Example 19-15 shows a <resource-env-ref-mapping> element for OEMS JMS.

      Example 19-15 OEMS JMS <resource-env-ref-mapping>

      <resource-env-ref-mapping
          name="rpTestTopic"
          location="jms/Topic/rpTestTopic">
      </resource-env-ref-mapping>
      
    2. Define a <resource-ref-mapping> element in the same OC4J-specific deployment descriptor (see "Where do you Configure an EJB Environment Reference?") and configure its name attribute to the JMS connection factory logical name (defined in the <resource-ref>), and its location attribute–to the JNDI name defined when you configured your JMS provider (see step 2).

      Example 19-16 shows a <resource-ref-mapping> element for OEMS JMS.

      Example 19-16 OEMS JMS <resource-ref-mapping>

      <resource-ref-mapping
          name="myTCF"
          location="jms/Topic/myTCF">
      </resource-ref-mapping>