1 Reply Latest reply on Jul 21, 2004 5:36 PM by fsimard

    Connecting a Remote JMS Queue from a Session Bean

    jbruce

      I am having trouble connecting to a queue located on a remote instance of JBoss.

      I tried setting up a connection factory as depicted in the example shown in the message titled - 'FAQ - Read this second'. It's very difficult to know exactly what has to be done when looking at the example. Sample code is given without any indication of where is must be placed. XML tags are also missing although I overcame that by saving the page and viewing it in a text editor.

      Could someone please give me an idea of how to connect to a remote queue from a session bean. What MBeans/Connection factories need to be set up? What sections must be added to the ejb-jar.xml and jboss.xml (eg. Resource Manager, resource-ref) and what should the content of these sections depict?

      I have been looking at the 'pay for' documentation but as yet it hasn't been of any help (Specifically JBoss Administration and Development Third Edition (3.2.x Series)).

      I placed the following in a *-ds.xml file in the deploy directory -

      [*Replace whatever with the server name]
      [***Certain tag elements have had < and > changed to [ and ] - so that they can be visible on the forum***]

      <connection-factories>
       [mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="jboss.mq:service=JMSProviderLoader,name=RemoteMQProvider,server=whatever"]
       [attribute name="ProviderName"]whatever[/attribute]
       [attribute name="ProviderUrl"]jnp://whatever:1099[/attribute]
       [attribute name="ProviderAdapterClass"]org.jboss.jms.jndi.JBossMQProvider[/attribute]
       [attribute name="QueueFactoryRef"]UIL2XAConnectionFactory[/attribute]
       [attribute name="TopicFactoryRef"]UIL2XAConnectionFactory[/attribute]
       [/mbean]
       <tx-connection-factory>
       <jndi-name>whateverJmsXA</jndi-name>
       <xa-transaction/>
       <adapter-display-name>JMS Adapter</adapter-display-name>
       <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
       <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/JMSProvider</config-property>
       <!--security-domain-and-application>JmsXARealm</security-domain-and-application-->
       </tx-connection-factory>
      </connection-factories>
      


      The following in the jboss.xml -

      <resource-manager>
       <res-name>whateverJmsXA</res-name>
       <res-jndi-name>jms/whateverJMS</res-jndi-name>
      </resource-manager>
      


      And the following in the ejb-jar.xml (within the session bean definition) -

      <resource-ref>
       <res-ref-name>jms/whateverJMS</res-ref-name>
       <res-type>javax.jms.QueueConnectionFactory</res-type>
       <res-auth>Container</res-auth>
      </resource-ref>
      


      Thanks