book
Article ID: KB0084707
calendar_today
Updated On:
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 = <the 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"?>
<connection-factories>
<!-- ==================================================================== -->
<!-- JMS Stuff -->
<!-- ==================================================================== -->
<!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->
<tx-connection-factory>
<jndi-name>JmsXA</jndi-name>
<local-transaction/>
<rar-name>genericra.rar</rar-name>
<connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
<security-domain-and-application>JmsXARealm</security-domain-and-application>
<max-pool-size>20</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 -->
. <classpath 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.
<!-- <invoker-proxy-binding-name>message-driven-bean</invoker-proxy-binding-name> Line below for genericra.rar -->
<invoker-proxy-binding-name>message-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:
<config-property>
<description>Tibco JNDI Properties</description>
<config-property-name>JndiProperties</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-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"?>
<ejb-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">
<enterprise-beans>
<message-driven>
<ejb-name>TextMDB</ejb-name>
<ejb-class>org.jboss.chap6.ex2.TextMDB</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Bean</transaction-type>
<!-- <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination> -->
<activation-config>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>ConnectionFactoryJndiName</activation-config-property-name>
<activation-config-property-value>QueueConnectionFactory</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>DestinationJndiName</activation-config-property-name>
<activation-config-property-value>queue/B</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>userName</activation-config-property-name>
<activation-config-property-value>JbossUser</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>password</activation-config-property-name>
<activation-config-property-value>jbossPassword</activation-config-property-value>
</activation-config-property>
</activation-config>
<resource-ref>
<res-ref-name>jms/QCF</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</message-driven>
</enterprise-beans>
</ejb-jar>
====================
b). Modify jboss.xml as following format:
====================
<?xml version="1.0"?>
<jboss>
<resource-managers>
<resource-manager>
<res-name>factoryref</res-name>
<res-jndi-name>java:/JmsXA</res-jndi-name>
</resource-manager>
</resource-managers>
<enterprise-beans>
<message-driven>
<ejb-name>TextMDB</ejb-name>
<destination-jndi-name>queue/B</destination-jndi-name>
<resource-adapter-name>genericra.rar</resource-adapter-name>
<resource-ref>
<res-ref-name>jms/QCF</res-ref-name>
<resource-name>factoryref</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.