Version 4

    Many organizations are heavily dependent on JMS for the exchange of messages/communication between the systems with the organization as well as with the external partners.There are various JMS providers,and also the different J2EE containers like Weblogic/Websphere/Jboss provide their own JMS support as well. Depending on the organizational needs,it's possible that you need to integrate JMS from any provider say Weblogic with MDB's deployed on another application server Jboss 5.1 in this case.

    JMSJCA(Sun JMS adapter) can be used for integrating the JMS providers with components deployed in another container.JMSJCA is an implementation of the Java Connector Architecture 1.5 that is used to integrate JMS providers within J2EE application servers. The following section demonstrates the integration of one JMS provider(Weblogic 8.1) with a component(an MDB) deployed in another J2EE container(Jboss5.1)

     

    Step 1)Change the jms-ds.xml file in Jboss:

     

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

    <connection-factories>
      <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
        name="jboss.messaging:service=JMSProviderLoader,name=JMSProvider">
        <attribute name="ProviderName">DefaultJMSProvider</attribute>
        <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
        <attribute name="FactoryRef">XAConnectionFactory</attribute>
        <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
        <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
        <attribute name="Properties">
        java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
        java.naming.provider.url=t3://weblogichostname:7001
        java.naming.security.authentication=none
        </attribute>
    </mbean>

       <no-tx-connection-factory>
         <jndi-name>CFX/ExternalConnectionFactory</jndi-name>
         <xa-transaction />
         <track-connection-by-tx />
         <rar-name>sun-jms-adapter.rar</rar-name>
         <connection-definition>javax.jms.TopicConnectionFactory </connection-definition>
         <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
         <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
         <config-property name="Destination" type="java.lang.String">javax.jms.Destination</config-property>
         <config-property name="ConnectionURL" type="java.lang.String"><![CDATA[t3://weblogichostname:7001/?   JMSJCA.WLFACTORY=TOPIC.TOPICNAME&prefix=jms/destinations;JMSJCA.NoXA=true></config-property>
           <min-pool-size>1</min-pool-size>
          <max-pool-size>200</max-pool-size>
           <blocking-timeout-millis>30000</blocking-timeout-millis>
           <idle-timeout-minutes>3</idle-timeout-minutes>
           </no-tx-connection-factory>
    </connection-factories

     

    The communcation can be established to a Queue or a Topic as per the need.Please change to queue or topic as per your need...above...:

     

    Step 2:Change the jboss.xml file for the MDB deployed in Jboss as follows :

    <?xml version="1.0"?> <!DOCTYPE jboss PUBLIC

         "-//JBoss//DTD JBOSS 5.0//EN"
         "http://www.jboss.org/j2ee/dtd/jboss_5_0.dtd">
    <jboss>

    <enterprise-beans>
    <message-driven>

    <ejb-name>NameOfMDB</ejb-name>
      <destination-jndi-name>java:/CFX/ExternalConnectionFactory</destination-jndi-name>
               <local-jndi-name>local/NameOfMDB</local-jndi-name>
           <resource-adapter-name>sun-jms-adapter.rar</resource-adapter-name>
           <configuration-name>JMSJCA Message Driven Bean</configuration-name>
    </message-driven>

      <invoker-proxy-bindings>
           <invoker-proxy-binding>
           <name>jmsjca-message-driven-bean</name>
           <invoker-mbean>default</invoker-mbean>
           <proxy-factory>org.jboss.ejb.plugins.inflow.JBossMessageEndpointFactory</proxy-factory>
           <proxy-factory-config>
           <activation-config>
           <activation-config-property>
                <activation-config-property-name>providerAdapterJNDI</activation-config-property-name>
                <activation-config-property-value>java:/DefaultJMSProvider</activation-config-property-value>
            </activation-config-property>
               <activation-config-property>
                    <activation-config-property-name>ConnectionURL</activation-config-property-name>
                    <activation-config-property-value>t3://weblogichostname:7001</activation-config-property-value>
                </activation-config-property>
            </activation-config>
           <endpoint-interceptors>
           <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
           <interceptor>org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor</interceptor>
           <interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
           <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
           </endpoint-interceptors>
           </proxy-factory-config>
           </invoker-proxy-binding>
       </invoker-proxy-bindings>
       <container-configurations>
           <container-configuration>
               <container-name>JMSJCA Message Driven Bean</container-name>
               <call-logging>false</call-logging>
               <invoker-proxy-binding-name>jmsjca-message-driven-bean</invoker-proxy-binding-name>
               <container-interceptors>
               <interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
               <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
               <interceptor>org.jboss.ejb.plugins.RunAsSecurityInterceptor</interceptor>
               <interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
               <interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
               <interceptor transaction="Container" metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
               <interceptor transaction="Container">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
               <interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
               <interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT</interceptor>
               <interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
               <interceptor transaction="Bean" metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
               <interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
               </container-interceptors>
               <instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
               <instance-cache></instance-cache>
               <persistence-manager></persistence-manager>
               <container-pool-conf>
               <MaximumSize>100</MaximumSize>
               </container-pool-conf>
           </container-configuration>
       </container-configurations>
    </jboss>

     

    Step 3: Change the ejb-jar.xml file for the MDB deployed in Jboss as follows:

     

    ejb-jar.xml:

    <?xml version="1.0"?>

    <ejb-jar>

    <enterprise-beans>

    <message-driven>
      <ejb-name>NameOfMDB</ejb-name>
      <ejb-class>MDBClassName(fully qualified)</ejb-class>
      <transaction-type>Bean</transaction-type>
      <acknowledge-mode>auto-acknowledge</acknowledge-mode>
          <activation-config>
              <activation-config-property>
                   <activation-config-property-name>concurrencyMode</activation-config-property-name>
                    <activation-config-property-value>cc</activation-config-property-value>
              </activation-config-property>
              <activation-config-property>
                  <activation-config-property-name>endpointPoolMaxSize</activation-config-property-name>
                  <activation-config-property-value>10</activation-config-property-value>
              </activation-config-property>
              <activation-config-property>
                 <activation-config-property-name>destination</activation-config-property-name>
                 <activation-config-property-value>TOPIC.TOPICNAME</activation-config-property-value>
              </activation-config-property>
              <activation-config-property>
                   <activation-config-property-name>destinationType</activation-config-property-name>
                   <activation-config-property-value>javax.jms.Topic</activation-config-property-value>
              </activation-config-property>
              <activation-config-property>
                  <activation-config-property-name>contextName</activation-config-property-name>
                  <activation-config-property-value>XContextName</activation-config-property-value>
               </activation-config-property>
             </activation-config>
    </message-driven>
    </enterprise-beans>

    </ejb-jar>

     

    With the above changes in place the MDB deployed in Jboss starts retrieving messages from the Queue/Topic in Weblogic JMS.