5 Replies Latest reply on Nov 12, 2014 2:34 PM by jose.e.chavez

    My experience with integrating HornetQ 2.1.1 and JBoss AS 4 (4.0.5-GA and 4.2.3-GA)

    kentxu2007

      I have been playing with HornetQ integration recently for connecting a legacy system in EJB2 running on JBoss 4.0.5-GA with other systems.

       

      HornetQ is impressive and the team's support on the forum and doc is  very helpful and better than many other projects I have seen. That's partially why I worte this post to give back a little.

       

      The HornetQ documentation is great for JBoss 5 and examples are very useful too. Everything works out of the box.

       

      When it comes to AS4 and EJB2, the information is murky and inaccurate in some cases. It is understandable since AS4 is old and not many new projects are using it. It took me a while to get MDB working. Since the wiki doc for "AS4 integration" is currently broken. I am going to post this hoping to help others in similar situation.

       

       

       

      1. fresh intall jboss 4.2.3-GA. (if you are using jboss 4.0.5-GA, you need to download the latest log4j.jar and replace the log4j-boot.jar in the lib directory. The old log4j does not have "trace" related methods and hornetq fails)


      2. run "build" from HornetQ 2.1.1 Final (config\jboss-as-4). I found "build.bat as4" (as in documentation) not working, just run it without the parameter.


      3. comment out the two "TransactionManagerLocatorMethod" properties in deploy/jms-ra.rar/META-INF/ra.xml. Most references point you to hornetq-ra.rar, it is not correct in my case.


      4. add a new queue to deploy/hornetq.sar/hornetq-ds.xml

       

             <queue name="sbLibTopic">
            <entry name="/queue/sbLibTopic"/>
           </queue>
          
      5. You can now verify sending and receiving message to this queue using simple standalone java client
              e.g. go into hornetq-lab directory and run "ant sendreceivemsg"

       

      6. edit standardjboss.xml, uncomment JMS message inflow from jmsra.rar section and comment out the default "message-drive-bean" invoker proxy binding. Restart jboss. I didn't see this step mentioned anywhere but it is crucial to get EJB working.

       

       

      7. test MDB. deploy the sample EJB 2 MDB to the deploy directory. Notice the reference to "jms-ra.rar" not hornetq-ra.rar. I only find a "jms-ra.rar" in my deploy director
              go into hornetq-lab directory and run "ant sendmsg"
              you should see the MDB consume the message and output something like " test: Shredder onMessage: HornetQMessage..."

       

       

      Source code attached, enjoy.

        • 1. Re: My experience with integrating HornetQ 2.1.1 and JBoss AS 4 (4.0.5-GA and 4.2.3-GA)
          clebert.suconic

          We were not going to support JBoss 4.0.5 at first, then an user contributed a patch for installing stuff on it. (Open Source is great, isn't?)

           

           

          So, I think you should contribute a WIKI and we could link it from the main hornetq wiki, or even better, if you want to contribute to the main doc, I would be glad to apply your changes so your experience would make into trunk.

          • 2. Re: My experience with integrating HornetQ 2.1.1 and JBoss AS 4 (4.0.5-GA and 4.2.3-GA)
            kentxu2007

            Here it is. I included some more notes about connecting to remote message server  and  JMS bridging. I hope it is helpful.

             

            https://community.jboss.org/wiki/IntegratingHornetQ211andJBossAS4withJMSbridge

            • 3. Re: My experience with integrating HornetQ 2.1.1 and JBoss AS 4 (4.0.5-GA and 4.2.3-GA)
              jmihalich1

                If only i had hit the right google search to find this 4 days ago LOL.  Thanks for posting this, step 6 in the wiki doc is critical for sure.  you're dead without it.

               

              Joe

              • 4. Re: My experience with integrating HornetQ 2.1.1 and JBoss AS 4 (4.0.5-GA and 4.2.3-GA)
                jbossaddict44

                Hello Kent,

                is there any special rights necessary to access the notes you created about HornetQ and JBoss AS 4 integration ?

                I'm not able to read the link https://community.jboss.org/wiki/IntegratingHornetQ211andJBossAS4withJMSbridget (no rights) but I do need these informations because I'm trying to migrate from JBossMQ to HornetQ on my JBoss 4.0.5 instances.

                Help or informations would be greatly appreciated.

                 

                Thank's in advance.

                • 5. Re: Re: My experience with integrating HornetQ 2.1.1 and JBoss AS 4 (4.0.5-GA and 4.2.3-GA)
                  jose.e.chavez

                  Unfortunately the wiki link above gives me restricted access page

                   

                  I am installing HornetQ 2.2.2.Final onto JBoss 4.2.3 to use MDBs and JMSBridge.

                   

                  In addition to the above steps, there was one additional step I had to do. In the file jboss-4.2.3.GA\server\all-with-hornetq\deploy\jms-ra.rar\META-INF\ra.xml, I had to add the InVMConnectorFactory to the resourceadapter node. The NettyConnectorFactory is already defined, so I added the InVM as an extra param. The ConnectionParameter would be server-id=0.

                   

                  Here is the final config slice:

                  <resourceadapter>

                        <resourceadapter-class>org.hornetq.ra.HornetQResourceAdapter</resourceadapter-class>

                        <config-property>

                           <description>

                              The transport type. Multiple connectors can be configured by using a comma separated list,

                              i.e. org.hornetq.core.remoting.impl.invm.InVMConnectorFactory,org.hornetq.core.remoting.impl.invm.InVMConnectorFactory.

                           </description>

                           <config-property-name>ConnectorClassName</config-property-name>

                           <config-property-type>java.lang.String</config-property-type>

                           <config-property-value>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory,org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</config-property-value>

                        </config-property>

                        <config-property>

                           <description>The transport configuration. These values must be in the form of key=val;key=val;,

                              if multiple connectors are used then each set must be separated by a comma i.e. host=host1;port=5445,host=host2;port=5446.

                              Each set of params maps to the connector classname specified.

                           </description>

                           <config-property-name>ConnectionParameters</config-property-name>

                           <config-property-type>java.lang.String</config-property-type>

                           <config-property-value>server-id=0,host=10.10.0.209;port=5445</config-property-value>

                        </config-property>

                         ...

                  </resourceadapter>


                  Once done, my MDB loaded properly