6 Replies Latest reply on Jan 25, 2013 3:55 PM by jbertram

    HornetQ standalone - JMS Bridge?

    matt1929x

      Hello:

       

      I'd like to use HornetQ standalone as a JMS Bridge (2.3 alpha 3) without transactions, however I'm getting issues with JBoss transaction related items not being found.

       

      Same exceptions as this person:

      https://community.jboss.org/thread/215861

       

      Is it possible to use HornetQ standalone with JMS?

       

      Thanks,

      Matt

        • 1. Re: HornetQ standalone - JMS Bridge?
          jbertram

          Quick guess...Did you try removing the dependency of the bridge on the transaction manager?

          • 2. Re: HornetQ standalone - JMS Bridge?
            matt1929x

            I removed the transaction references from the hornetq-beans.xml, didn't see other transaction references in the other config files in the config/standalone/non-clustered folder.

             

            <!-- The JMS Bridge -->

               <bean name="JMSBridge" class="org.hornetq.jms.bridge.impl.JMSBridgeImpl">

                       <constructor>

                           <!-- Source ConnectionFactory Factory -->

                           <parameter>

                               <inject bean="SourceCFF"/>

                           </parameter>

                           <!-- Target ConnectionFactory Factory -->

                           <parameter>

                               <inject bean="TargetCFF"/>

                           </parameter>

                           <!-- Source DestinationFactory -->

                           <parameter>

                               <inject bean="SourceDestinationFactory"/>

                           </parameter>

                           <!-- Target DestinationFactory -->

                           <parameter>

                               <inject bean="TargetDestinationFactory"/>

                           </parameter>

                           <!-- Source username (no username here) -->

                           <parameter><null /></parameter>

                           <!-- Source password (no password here)-->

                           <parameter><null /></parameter>

                           <!-- Target username (no username here)-->

                           <parameter><null /></parameter>

                           <!-- Target password (no password here)-->

                           <parameter><null /></parameter>

                           <!-- Selector -->

                           <parameter><null /></parameter>

                           <!-- Interval to retry in case of failure (in ms) -->

                           <parameter>5000</parameter>

                           <!-- Maximum number of retries to connect to the source and target -->

                           <parameter>10</parameter>

                           <!-- Quality of service -->

                           <parameter>ONCE_AND_ONLY_ONCE</parameter>

                           <!-- Maximum batch size -->

                           <parameter>1</parameter>

                           <!-- Maximum batch time (-1 means infinite) -->

                           <parameter>-1</parameter>

                           <!-- Subscription name (no subscription name here)-->

                           <parameter><null /></parameter>

                           <!-- client ID  (no client ID here)-->

                           <parameter><null /></parameter>

                           <!-- concatenate JMS messageID to the target's message header -->

                           <parameter>true</parameter>

                           <!-- register the JMS Bridge in the JMX MBeanServer -->

                           <parameter>

                               <inject bean="MBeanServer"/>

                           </parameter>

                           <parameter>org.hornetq:service=JMSBridge</parameter>

                       </constructor>

                  <!--     <property name="transactionManager">

                           <inject bean="TransactionManager"/>

                       </property>

                     --> 

                       <!-- HornetQ JMS Server must be started before the bridge -->

                       <depends>JMSServerManager</depends>

             

                   </bean>

            <!--

                   <bean name="TransactionManager" class="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple">

                   </bean>

            -->

             

             

             

            13:37:35,558 INFO  [org.hornetq.core.server] HQ221003: HornetQ Server version 2.3.0.BETA3 (HornetQ sting, 122) [aaea1a2c-671c-11e2-9772-196f933b31ea]

            13:37:35,642 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=JMSBridge state=Create: java.lang.IllegalStateException: unable to create TransactionManager from org.hornetq.integration.jboss.tm.JBoss5TransactionManagerLocator.getTm

                    at org.hornetq.jms.bridge.impl.JMSBridgeImpl.getTm(JMSBridgeImpl.java:1000) [hornetq-jms-server.jar:]

                at org.hornetq.jms.bridge.impl.JMSBridgeImpl.start(JMSBridgeImpl.java:342 [hornetq-jms-server.jar:]
            • 3. Re: HornetQ standalone - JMS Bridge?
              matt1929x

              Looks like the JMSBridgeImpl expects a TransactionManager to be defined and loaded, the getTM() will throw an exception if it can't load a transaction manager.

               

              TransactionManager tm = getTm();

               

                    // There may already be a JTA transaction associated to the thread

               

                    boolean ok;

               

                    Transaction toResume = null;

                    try

                    {

                       toResume = tm.suspend();

               

                       ok = setupJMSObjects();

                    }

                    finally

                    {

                       if (toResume != null)

                       {

                          tm.resume(toResume);

                       }

                    }

               

              How can a default transactionmanager be packaged with HornetQ so it won't fail on startup when using the JMSBridge feature?

               

              Will JMSBridge work with  IBM MQSeries endpoints if the HornetQ included with the latest JBoss is used instead of standalone?

              • 4. Re: HornetQ standalone - JMS Bridge?
                jbertram

                Ok, so the bridge is hard-wired to look for the transaction manager.  Since that's the case you can either:

                1. Not use the JMS bridge.  Maybe the HornetQ bridge would work for your use-case?
                2. Change the JMS bridge to not require the transaction manager.  This seems reasonable given that the bridge can be run in HornetQ standalone which does not have a JTA transaction manager by default.
                3. Run HornetQ in an application server which does have a JTA transaction manager (e.g. JBoss AS7 - you would need a nightly build since the JMS bridge isn't configurable in earlier versions).
                4. Install a JTA transaction manager in the HornetQ standalone server. I'm not even sure that's possible, but it's worth trying Naranaya again since the logging frameworks used by both should match now (Narayana uses JBoss Logging 3 and we switched that in HornetQ 2.3).  That should avoid the problem noted on https://community.jboss.org/thread/215861.  If you do get this working please report back and we can add instructions to the documentation.
                • 5. Re: HornetQ standalone - JMS Bridge?
                  matt1929x

                  I tried #4, which worked for me. 

                   

                  Downloaded narayana-full-4.17.3.Final,   copied the transaction related jars from the lib folder tree into the hornetq lib folder.     After restart the server was able to load the transaction manager without exceptions.

                  • 6. Re: HornetQ standalone - JMS Bridge?
                    jbertram

                    Thanks for the update.  I'll find a place in the docs for this.