JBOSS 6.0 integration with EMS server 5.x/6.x using GenericJMSRA Resource Adapter.

JBOSS 6.0 integration with EMS server 5.x/6.x using GenericJMSRA Resource Adapter.

book

Article ID: KB0084707

calendar_today

Updated On:

Products Versions
TIBCO Enterprise Message Service -
Not Applicable -

Description

Resolution:
Description:
==========
How to integrate JBoss 6.0 App Server With EMS and GenericJMSRA Resource Adapter.

Resolution:
=========
You can use the following steps to integrate JBOSS 6.0 with EMS server 5.x or 6.x using generic RA:

JBOSS_HOME = &ltthe directory where JBOSS is installed>
JBOSS_DEPLOY = %JBOSS_HOME%\server\default\deploy
JBOSS_CONF = %JBOSS_HOME%\server\default\conf

1).  Install JDK 1.6 and JBOSS 6.0. JBOSS 6.0 requires JDK 1.6.

2).  Delete directories: hornetq, jms-ra.rar under %JBOSS_DEPLOY%.  

3).  Create a directory: jms under %JBOSS_DEPLOY% directory, create a jms-tibco-genericra-ds.xml file.

The jms-tibco-genericra-ds.xml file looks like following:

============
<?xml version="1.0" encoding="UTF-8"?>

&ltconnection-factories>

  <!-- ==================================================================== -->
  <!-- JMS Stuff                                                            -->
  <!-- ==================================================================== -->

  <!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->
  &lttx-connection-factory>
    &ltjndi-name&gtJmsXA</jndi-name>
    &ltlocal-transaction/>
    &ltrar-name&gtgenericra.rar</rar-name>
    &ltconnection-definition&gtjavax.jms.QueueConnectionFactory</connection-definition>
    &ltsecurity-domain-and-application&gtJmsXARealm</security-domain-and-application>
    &ltmax-pool-size&gt20</max-pool-size>
  </tx-connection-factory>

</connection-factories>

===========

4). Modify %JBOSS_CONF%\jboss-service.xml to add EMS to the classpath. Add the following lines within jboss-service.xml (modify based on your EMS installation):

   . <!-- TIBCO Enterprise Message Service classpath -->
   . &ltclasspath codebase="file:/Tibco/ems/6.0/lib" archives="tibjms.jar" />
  
5). Modify %JBOSS_CONF%\standardjboss.xml to change message-driven-bean to message-inflow-driven-bean proxy binding.

<!-- &ltinvoker-proxy-binding-name&gtmessage-driven-bean</invoker-proxy-binding-name> Line below for genericra.rar -->
      &ltinvoker-proxy-binding-name&gtmessage-inflow-driven-bean</invoker-proxy-binding-name>
      
6). Deploy the genericra.rar to JBoss

Copy the attached file genericra.rar, to %JBOSS_DIST%\server\default\deploy\jms. Use the attached genericra.rar, which is modified for EMS integration. The genericra.rar is configured JNDI lookup properties in ra.xml file. The JNDI provider URL is defined to: "tibjmsnaming://localhost:7222", JNDI lookup username and password are defined to jbosslookup, password.

If your EMS server URL and JNDI lookup username and password are different than these values, you will need to change following config-property for Tibco JNDI Properties in ra.xml for your own value and then repackage genericra.rar:

       &ltconfig-property>
            &ltdescription&gtTibco JNDI Properties</description>
            &ltconfig-property-name&gtJndiProperties</config-property-name>
            &ltconfig-property-type&gtjava.lang.String</config-property-type>
            &ltconfig-property-value>
java.naming.factory.url.pkgs=com.tibco.tibjms.naming,java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory,java.naming.provider.url=tibjmsnaming://localhost:7222,java.naming.security.principal=jbosslookup,java.naming.security.credentials=password
            </config-property-value>
        </config-property>        
        
7). Make the following changes in MDB. The attached MDB example receives messages from a queue. It can reply the message to the reply queue (not temporary queue) if the sender requests a reply.

a) Modify ejb-jar.xml file as following format:

==============
<?xml version="1.0" encoding="US-ASCII"?>
&ltejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
   version="2.1">

    &ltenterprise-beans>
        &ltmessage-driven>
            &ltejb-name&gtTextMDB</ejb-name>
            &ltejb-class&gtorg.jboss.chap6.ex2.TextMDB</ejb-class>
            &ltmessaging-type&gtjavax.jms.MessageListener</messaging-type>
            &lttransaction-type&gtBean</transaction-type>
           <!--  &ltacknowledge-mode&gtAUTO_ACKNOWLEDGE</acknowledge-mode>
            &ltmessage-driven-destination>
                &ltdestination-type&gtjavax.jms.Queue</destination-type>
            </message-driven-destination>  -->
      &ltactivation-config>
        &ltactivation-config-property>
          &ltactivation-config-property-name&gtdestinationType</activation-config-property-name>
          &ltactivation-config-property-value&gtjavax.jms.Queue</activation-config-property-value>
        </activation-config-property>
         &ltactivation-config-property>
          &ltactivation-config-property-name&gtConnectionFactoryJndiName</activation-config-property-name>
          &ltactivation-config-property-value&gtQueueConnectionFactory</activation-config-property-value>
        </activation-config-property>
         &ltactivation-config-property>
          &ltactivation-config-property-name&gtDestinationJndiName</activation-config-property-name>
          &ltactivation-config-property-value&gtqueue/B</activation-config-property-value>
        </activation-config-property>        
        &ltactivation-config-property>
              &ltactivation-config-property-name&gtuserName</activation-config-property-name>
              &ltactivation-config-property-value&gtJbossUser</activation-config-property-value>
        </activation-config-property>        
         &ltactivation-config-property>
                  &ltactivation-config-property-name&gtpassword</activation-config-property-name>
                  &ltactivation-config-property-value&gtjbossPassword</activation-config-property-value>
        </activation-config-property>        
        </activation-config>  
        
             &ltresource-ref>
                &ltres-ref-name&gtjms/QCF</res-ref-name>
                &ltres-type&gtjavax.jms.QueueConnectionFactory</res-type>
                &ltres-auth&gtContainer</res-auth>
            </resource-ref>
        </message-driven>
    </enterprise-beans>
</ejb-jar>
====================
      
b). Modify jboss.xml as following format:

====================
<?xml version="1.0"?>
&ltjboss>
  &ltresource-managers>
    &ltresource-manager>
      &ltres-name&gtfactoryref</res-name>
      &ltres-jndi-name&gtjava:/JmsXA</res-jndi-name>
    </resource-manager>
  </resource-managers>

  &ltenterprise-beans>
    &ltmessage-driven>
      &ltejb-name&gtTextMDB</ejb-name>
      &ltdestination-jndi-name&gtqueue/B</destination-jndi-name>
      &ltresource-adapter-name&gtgenericra.rar</resource-adapter-name>
      &ltresource-ref>
        &ltres-ref-name&gtjms/QCF</res-ref-name>
        &ltresource-name&gtfactoryref</resource-name>
      </resource-ref>
    </message-driven>
  </enterprise-beans>
</jboss>
===================

c). Repackage the MDB jar file and deploy the MDB jar file in %JBOSS_DEPLOY% directory.

8). Make sure the EMS server has defined the connection factories: QueueConnectionFactory and queues: queue/DLQ, the queue being used by MDB. In the attached MDB example, the queue being used is queue/B.

9). Start JBOSS 6.0 by running: run.bat under %JBOSS_HOME%\bin directory. Send some messages to the queue which the MDB receives from and check if MDB receives the messages.

Attachments
==========
File: chap6-ex2.jar
File: genericra.rar

Issue/Introduction

JBOSS 6.0 integration with EMS server 5.x/6.x using GenericJMSRA Resource Adapter.

Attachments

JBOSS 6.0 integration with EMS server 5.x/6.x using GenericJMSRA Resource Adapter. get_app
JBOSS 6.0 integration with EMS server 5.x/6.x using GenericJMSRA Resource Adapter. get_app