12 Replies Latest reply on Nov 12, 2014 2:13 PM by Jose E. Chavez

    JBoss 4.x integration experience

    Vadim Kopichenko Newbie

      Hi, All.

       

      I'd like to provide some feedback on our hornetq-2.1.1.Final and JBoss 4.2.3.GA integration.

       

      We needed to replace JBossMQ in cluster cause it's active only on one node and requires hajndi access from others.

      Decided to skip JBM in favor of newer and faster HornetQ implementation.

      Alter all, the goal was achieved.

      HornetQ works faster and need's no database and much less open ports than clustered JBM. It's nice.

       

      http://community.jboss.org/wiki/HornetQGeneralFAQs says "Yes, HornetQ can be integrated seamlessly into JBoss Application Server version 4.x"

      Now I can confirm that this is almost true. With some exception for "seamlessly".

       

      There were a couple of issues faced.

       

      http://community.jboss.org/wiki/HornetQ has dead link "Using JBoss 4.x with HornetQ".

       

      Obsolete TransactionManagerLocator props and warns in jca resouce adaptor
      https://jira.jboss.org/browse/HORNETQ-456

       

      Unknown jndi port in jboss-as-4\clustered\jms-ds.xml
      https://jira.jboss.org/browse/HORNETQ-460

       

      jboss-as-4 install could use InVM connection for resouce adaptor by default
      https://jira.jboss.org/browse/HORNETQ-461

       

      InVM server-id meaning clarification
      http://community.jboss.org/thread/154719

       

      InVM connection silently hangs forever if no acceptor with matching server-id
      https://jira.jboss.org/browse/HORNETQ-458

       

      It's working now.

      Happy end.

        • 1. Re: JBoss 4.x integration experience
          Vadim Kopichenko Newbie

          Forgot to mention, we previously relayed on JBossMQ's autocreation of temporary queues.

          But now had to explicitly define queues in hornetq.sar\hornetq-jms.xml.

           

          We use ejb3 MBDs.

          Those using ejb2 should look also at HornetQ Jboss as4 with EJB2.1 adjustments.

          • 2. Re: JBoss 4.x integration experience
            Clebert Suconic Master

            auto-creationg is being done at JBoss 6. (JBoss Trunk).

             

            BTW: you can afford trying HornetQ on JBoss 4, but you can't afford trying JBoss 5 at least? I wonder what would be the reason for moving up to a newer JMS implementation and not move up with a newer JBoss AS.

            • 3. Re: JBoss 4.x integration experience
              Feng Hou Newbie

              Hi,

               

              Regarding warning in jca resouce adaptor https://jira.jboss.org/browse/HORNETQ-456. It seems a bug introduced in post 2.0.0 code (become more 5.1 focused?). I'm almost certain JCA JTA intigration doesn't work with Jboss 4.2.3.GA anymore.

               

              Two issues in the code.

               

              1) Missing inner loop for "getTm;getTM" locatorMethod.

               

              Index: D:/workspace/Hornetq_2_1_1_Final/src/main/org/hornetq/ra/HornetQResourceAdapter.java
              ===================================================================
              --- D:/workspace/Hornetq_2_1_1_Final/src/main/org/hornetq/ra/HornetQResourceAdapter.java    (revision 9357)
              +++ D:/workspace/Hornetq_2_1_1_Final/src/main/org/hornetq/ra/HornetQResourceAdapter.java    (working copy)
              @@ -1425,11 +1425,13 @@
                    
                     for (int i = 0 ; i < locatorClasses.length; i++)
                     {
              -         tm = Util.locateTM(locatorClasses[i], locatorMethods[i]);
              +        for (int j = 0; j < locatorMethods.length; j++) {
              +            tm = Util.locateTM(locatorClasses[i], locatorMethods[j]);
                            if (tm != null)
                            {
                               break;
                            }
              +        }
                     }
                    
                     if (tm == null)

               

              2) HornetQResourceAdapter class might be missing TransactionManagerClass/Method bean methods. JCA ra.xml and MDB ActiviationSpec can't take any custom settings (seen NoSuchMethod exception for both)

               

              #1 is necessary to make it work. #2 is not strictly needed with current hard coded locatorClass and locatorMethod combinations (at least for 4.2).

               

              HornetQ is a very impressive piece of open source software, both the design/feature choices it made, as well as the implemenation. Keep up the good work and spirit :-)

               

              Regards,

              - Feng Hou

              • 4. Re: JBoss 4.x integration experience
                Clebert Suconic Master

                Someone also posted about it some time ago.

                 

                 

                There's a TM locator for the AS4 also. I believe if you just remove the locator, the default properties should work as they will use the locator for AS4 also.

                • 5. Re: JBoss 4.x integration experience
                  Vadim Kopichenko Newbie

                  Clebert Suconic wrote:

                   

                  BTW: you can afford trying HornetQ on JBoss 4, but you can't afford trying JBoss 5 at least? I wonder what would be the reason for moving up to a newer JMS implementation and not move up with a newer JBoss AS.

                  Switching JBoss version would require more effort than just jms implementation.

                  Hope we would jump to JBoss 6 GA in near future.

                  There's a TM locator for the AS4 also. I believe if you just remove the locator, the default properties should work as they will use the locator for AS4 also.

                  Could you, please, confirm that HornetQResourceAdapter's warns on TransactionManagerLocator harmless then?

                  Maybe, we need to ask ataylor for sure.

                  Is there an easy way to diagnoze that TM locator picked up correctly?

                  • 6. Re: JBoss 4.x integration experience
                    Tim Fox Master

                    The transaction manager issue is a known issue reported a couple of weeks back by Andy or Clebert (I don't remember who exactly).

                     

                    I assume they created a JIRA for it at the time... ?

                    • 7. Re: JBoss 4.x integration experience
                      Vadim Kopichenko Newbie

                      I've managed to find only

                      "Provide a better SPI to locate the Transaction Manager" by Clebert

                      https://jira.jboss.org/browse/HORNETQ-417

                      and it doesn't say that something is broken.

                       

                      Also found an issue

                      "JCA adapter dependant on jboss transaction spi"

                      https://jira.jboss.org/browse/HORNETQ-119

                      and related thread

                      http://community.jboss.org/message/71918#71918

                      where Andy Taylor on Sep 3, 2009 says

                      "Ive added some extra configuration for specifying the class/method to create the tx manager".

                      But later that same month he removes it with commit

                      "7998     28 Sep 09     removed transaction manager refrences in RA adapter     ataylor      trunk".

                      Logic demands that it was done in favor of some alternative way to locate TM.

                      That was even before final 2.0.0 release.

                       

                      Please, can some one tell how bad the things are with transactions support in JBoss 4.x with hornetq jca adaptor?

                      Is jms stuff not enlisted in current ejb tx at all? Or problem applies only to some marginal cases?

                      • 8. Re: JBoss 4.x integration experience
                        Tim Fox Master

                        AIUI, this doesn't affect the operation at all.

                         

                        It's simply a case that Andy/Clebert forgot to remove the old property from the xml file in the distro, it's no longer used.

                         

                        Why they didn't add a JIRA I do not know.

                         

                        Andy, Clebert, please comment!

                        • 9. Re: JBoss 4.x integration experience
                          Josh Nakatabe Newbie

                          May I humbly bump that issue back to top. What's the status of Vadim's question?

                           

                          Vadim Kopichenko wrote:

                          Please, can some one tell how bad the things are with transactions support in JBoss 4.x with hornetq jca adaptor?

                           

                          So, is that warning

                              

                          It wasn't possible to lookup for a Transaction Manager through the configured properties TransactionManagerLocatorClass and   TransactionManagerLocatorMethod

                           

                          a real bug or is it just misleading trash from previous revisions that can happily be ignored?

                          • 10. Re: JBoss 4.x integration experience
                            Joerg Glandorf Newbie

                            Yesterday I started a to replace jboss messaging by hornetq in jboss 4.2.3

                            and I can confirm that the warnings are still there. It may not be serious but it bothers me.

                             

                            The easiest for me was to download hornetq 2.1.2 sources and change 1 line in src\main\org\hornetq\ra\HornetQRAProperties.java

                             

                            private String transactionManagerLocatorClass = "org.hornetq.integration.jboss.tm.JBoss5TransactionManagerLocator;org.hornetq.integration.jboss.tm.JBoss4TransactionManagerLocator";

                             

                            to

                             

                            private String transactionManagerLocatorClass = "org.hornetq.integration.jboss.tm.JBoss4TransactionManagerLocator;org.hornetq.integration.jboss.tm.JBoss5TransactionManagerLocator";

                            i.e I reversed the order of the lookup  (see HornetQResourceAdapter.java locateTM() )

                             

                            or simply

                             

                            private String transactionManagerLocatorClass = "org.hornetq.integration.jboss.tm.JBoss4TransactionManagerLocator;

                             

                             

                             

                            For a jboss 4 it will then first try to locate the TM via the org.hornetq.integration.jboss.tm.JBoss4TransactionManagerLocator. If it first uses the the JBoss5TransactionManagerLocator it will result in a class not found exception (because JBoss5TransactionManagerLocator.getTM() calls a function which does not exist on a jboss 4)

                             

                             

                            Additionally I removed the (wrong) parts form META-INF/ra.xml 

                             

                            simply comment out:

                            <config-property>

                                    <description>The class that will locate the transactionmanager</description>

                                    <config-property-name>TransactionManagerLocatorMethod</config-property-name>

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

                                    <config-property-value>org.hornetq.integration.jboss.tm.JBoss4TransactionManagerLocator</config-property-value>

                                  </config-property>

                             

                                  <config-property>

                                    <description>The method to use for locate the transactionmanager</description>

                                    <config-property-name>TransactionManagerLocatorMethod</config-property-name>

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

                                    <config-property-value>getTm</config-property-value>

                                  </config-property>

                             

                             

                            The config-property is duplicated resp. the first one wrong. I think it  should be <config-property-name>TransactionManagerLocatorClass</config-property-name>

                             

                                If you wanted to really use these properties for external configuration you'd need to add 2 setter/getter functions to HornetQResourceAdaper.java (which then set it in raProperties)

                             

                             

                                e.g.

                                 public void setTransactionManagerLocatorMethod(final String transactionManagerLocatorMethod)

                                    {

                                           if (trace)

                                       {

                                          log.trace("setTransactionManagerLocatorMethod(" + transactionManagerLocatorMethod + ")");

                                       }

                             

                                       raProperties.setTransactionManagerLocatorMethod(transactionManagerLocatorMethod);

                                   }

                             

                                   public String getTransactionManagerLocatorMethod()

                                    {

                                       return raProperties.getTransactionManagerLocatorMethod();

                                     }

                             

                             

                             

                                  public void setTransactionManagerLocatorClass(final String transactionManagerLocatorClass)

                                    {

                                           if (trace)

                                       {

                                          log.trace("transactionManagerLocatorClass(" + transactionManagerLocatorClass + ")");

                                       }

                             

                                       raProperties.setTransactionManagerLocatorClass(transactionManagerLocatorClass);

                                   }

                             

                                   public String getTransactionManagerLocatorClass()

                                    {

                                       return raProperties.getTransactionManagerLocatorClass();

                                     }

                             

                             

                            compiling everything with build.bat went fine and I replaced the hornetq-ra.jar in the deploy/jms-ra.rar directory.Then jboss 4.2.3 started without warning.

                            • 12. Re: Re: JBoss 4.x integration experience
                              Jose E. Chavez Newbie

                              I too am integrating HornetQ 2.2.2.GA into JBoss 4.2.3.

                               

                              I followed the code changes, but ran into 2 issues.

                               

                              First Issue: I downloaded the source from the jboss.org website. I saw that inside there was a build.bat, which produced following error when I executed (added %USERPROFILE% to mask my directory):

                              BUILD FAILED

                              %USERPROFILE%\hornetq-2.2.2.Final\source\build.xml:134: The following error occurred while executing this line:

                              %USERPROFILE%\hornetq-2.2.2.Final\source\build-hornetq.xml:1195: The following error occurred while executing this line:

                              %USERPROFILE%\hornetq-2.2.2.Final\source\build-maven.xml:169: Execute failed: java.io.IOException: Cannot run program "mvn" (in dir

                              ectory "%USERPROFILE%\hornetq-2.2.2.Final\source\build"): CreateProcess error=2, The system cannot find the file specified

                               

                              I fixed this by modifying the lines <exec executable="mvn" dir="./build"> with <exec executable="${basedir}/tools/maven/bin/mvn.bat" dir="./build">

                               

                              After this, the build was successful.

                               

                              Second issue: Seems the xml file %USERPROFILE%\hornetq-2.2.2.Final\config\jboss-as-4\clustered\jms-ds.xml has a typo in the first mbean definition, having an additional attribute </attribute>. Removing this, then running the build.bat produced the proper all-with-hornetq and default-with-hornetq server entries in my jboss-4.2.3.GA\server directory. Make sure JBOSS_HOME is set to <location>\jboss-4.2.3.GA.

                               

                              After this, I ran JBoss 4 with run.bat -c all-with-hornetq with no issues

                               

                              EDIT: As for MDBs, I had to do some additional steps found here:

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