6 Replies Latest reply on Dec 26, 2013 1:48 AM by jonbondash

    Problem in posting JMS Messages to Clustered JBoss AS7 server's Queue

    jonbondash

      Hi All,

       

       

      I have two Jboss standalone  Clustered server behaving as Master & Slave and One Non-Cluster standalone  jboss server.

      We are able to discover the Master & Slave through MDB's ejb-jar.xml file, when Master or Slave goes down, which is running in Non Cluster server. But during sending JMS message from Non Cluster server's MDB to the Clustered server's JMS queue, we are facing connection failure issue.

       

       

      The above scenario is happening when Master is down, and we are not able to auto discover the active Cluster server from Java Code, which is running inside MDB.

       

       

      Please anyone help me on this.

      Also I have written a Sample Client code to post a message to the Clustered JMS Queue, but that is not working. I have attached the Sample code & My Clustered Jboss Configuration for further reference. Please let me know if i have missed any configuration.

       

       

       

       

       

       

      Thanks & Regards,

      Jonbon Dash

        • 1. Re: Problem in posting JMS Messages to Clustered JBoss AS7 server's Queue
          jbertram

          We are able to discover the Master & Slave through MDB's ejb-jar.xml file, when Master or Slave goes down, which is running in Non Cluster server.

          Can you attach the MDB's ejb-jar.xml?

           

          But during sending JMS message from Non Cluster server's MDB to the Clustered server's JMS queue, we are facing connection failure issue.

          Are you getting an exception?  If so, what is it? 

           

          Can you attach the sending code and the server configuration for the non-clustered node?

           

          Also I have written a Sample Client code to post a message to the Clustered JMS Queue, but that is not working.

          What exactly do you mean by "not working"?  Are you getting an exception?  If so, what is it?  Please elaborate.

           

          One thing I noticed immediately in your attached Sender.java is that you're creating a transacted session (see line 62) but you never call javax.jms.Session.commit() so your message(s) will never get sent.

          • 2. Re: Re: Problem in posting JMS Messages to Clustered JBoss AS7 server's Queue
            jonbondash

            Hi Justin,

             

            Thanks for quick response.

            I have attached Non Cluster server configuration (standalone-full_115.xml) & MDB's ejb-jar.xml.

            192.168.19.246:30001 is the address of mod_cluster.

             

            I have tried with different approach to send JMS message to clustered environment, I have attached those scenarios error logs & java code to get those logs in single file (Sender.java).

            Currently from our MDB we are using the 1st approach to send the jms request to the clustered queue. Also I have enable UDP port (9876) in both Clustered(246 & 148) server.

             

            One more thing, by using the 1st approach we are able to send jms request to any non cluster server (By  using jms messaging port called 5445)

            Please guide me further.

             

             

            Thanks & Regards,

            Jonbon Dash

            • 3. Re: Re: Problem in posting JMS Messages to Clustered JBoss AS7 server's Queue
              jbertram

              The error message in 1st_Scenario_error.txt.zip indicates you're simply using the wrong IP:port combination (i.e. 192.168.19.246:30001).  You say, "192.168.19.246:30001 is the address of mod_cluster," so I have no idea why you're trying to use it for HornetQ.  Simply put, HornetQ doesn't connect to mod_cluster.  I'm curious as to why would try to connect a HornetQ client to mod_cluster.

               

              The error message in 2nd&3rd_Scenario_error.txt.zip (i.e. "bad argument for IP_MULTICAST_IF: address not bound to any interface") indicates you're using an invalid local bind address (i.e. 192.168.19.246).

               

              The error message in 4th&5th&6th_Scenario_error.txt.zip (i.e. "Timed out waiting to receive initial broadcast from cluster") indicates that multicast isn't working between your machine where you're client is running and the machines running your clustered HornetQ instances.  Check with your network administrator to ensure multicast is working properly between all 3 machines.

              • 4. Re: Re: Re: Problem in posting JMS Messages to Clustered JBoss AS7 server's Queue
                jonbondash

                Hi Justin,

                 

                As in ejb-jar.xml by providing mod cluster "IP:port" and discoveryAddress:port,  we are able to discover which server is currently behaving as Active (Master ) and if active sever goes down, it is doing auto discovery establishing connection with the Slave.

                Like the same approach mentioned above, i want to achieve inside the MDB, when it is trying send the respond back to the remote JMS queue through JMS producer code( For example Sender.java), which will do auto discovery of the which Server is currently behaving as Active. But currently that is not happening.

                 

                For your better understanding the below mentioned scenarios I have tested in production environment,

                 

                When I provided Master Remote IP: 192.168.19.246 & Port: 25445 in 115 server

                Scenario 1:

                Master---> UP

                Slave ----> UP

                (We are able to post message from the MDB to the Master side JMS queue)

                Scenario 2:

                Master ---> Down

                Slave --> UP

                (We are not able to post message from the MDB to the Slave side JMS queue, & getting connection failure error)

                 

                So to avoid the above problem, I want use the mod cluster IP & port in my producer code.

                 

                It will be helpful, if you send me some code, by which I can do auto-discovery of the Active Cluster server.

                 

                The error message in 2nd&3rd_Scenario_error.txt.zip (i.e. "bad argument for IP_MULTICAST_IF: address not bound to any interface") indicates you're using an invalid local bind address (i.e. 192.168.19.246).
                I have not defined any local bind address in Clustered server's configuration file. Let me try this approach and let you know what's the result...

                 

                 

                Thanks & Regards,

                Jonbon Dash

                • 5. Re: Re: Re: Re: Problem in posting JMS Messages to Clustered JBoss AS7 server's Queue
                  jbertram

                  As I indicated before, I have no idea why you're trying to make your HornetQ client talk to mod_cluster.  Mod_cluster has absolutely nothing to do with HornetQ fail-over or load-balancing at any level.  Your ejb-jar.xml has this:

                   

                  <activation-config-property>
                      <activation-config-property-name>connectorClassName</activation-config-property-name>
                      <activation-config-property-value>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</activation-config-property-value>
                  </activation-config-property>
                  <activation-config-property>
                      <activation-config-property-name>connectionParameters</activation-config-property-name>
                      <activation-config-property-value>host=192.168.19.246;port=30001</activation-config-property-value>
                  </activation-config-property>
                  <activation-config-property>
                      <activation-config-property-name>discoveryAddress</activation-config-property-name>
                      <activation-config-property-value>231.7.7.7</activation-config-property-value>
                  </activation-config-property>
                  <activation-config-property>
                      <activation-config-property-name>discoveryPort</activation-config-property-name>
                      <activation-config-property-value>9876</activation-config-property-value>
                  </activation-config-property>
                  

                   

                  Since the "discoveryAddress" activation configuration property is set that means the "connectorClassName" and "connectionParameters" activation configuration properties are ignored completely.  They have no impact whatsoever, and should be removed.  If the HornetQ JCA RA did try to use those properties it would fail to connect since HornetQ can't talk to mod_cluster.  The HornetQ JCA RA is using the "discoveryAddress" and "discoveryPort" activation configuration properties to discover a running server.  That's the reason it is able to connect.

                   

                  If you're really connecting to a HornetQ live/backup pair then you should have the "hA" activation configuration property set to "true" so that you can get real fail-over.  My guess is that fail-over is being approximated here because you're using "-1" for "setupAttempts" so that when one server fails it will try to re-setup the activation.

                   

                  So to avoid the above problem, I want use the mod cluster IP & port in my producer code.

                  You just need to forget about mod cluster.  As I said before, it has nothing to do with HornetQ.

                   

                  It will be helpful, if you send me some code, by which I can do auto-discovery of the Active Cluster server.

                  Take a look at the "symmetric-cluster" example shipped with HornetQ. 

                   

                  I have not defined any local bind address in Clustered server's configuration file.

                  I wasn't referring to anything in your Clustered server's configuration file.  I was referring to your Sender.java - specifically these lines:

                   

                  //2nd-- Scenario
                  /*ConnectionFactory cf = (ConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA( new DiscoveryGroupConfiguoration("dg-group1", "192.168.19.246", "231.7.7.7", 9876, 10000, 30000), JMSFactoryType.CF);*/ 
                  
                  //3rd Scenario
                  /*ConnectionFactory cf = (ConnectionFactory) HornetQJMSClient.createConnectionFactoryWithHA( new DiscoveryGroupConfiguration("dg-group1", "192.168.19.246", "231.7.7.7", 9876, 10000, 30000), JMSFactoryType.CF);*/
                  

                   

                  In these lines you are most certainly defining a local bind address (i.e. "192.168.19.246"). 

                   

                   

                  Also, based on the API calls you're making it looks like you're on an older version of HornetQ (looks like 2.2.x).  I recommend you move to something more recent like 2.4.0.Final.

                  • 6. Re: Problem in posting JMS Messages to Clustered JBoss AS7 server's Queue
                    jonbondash

                    Hi Justin,

                     

                    Thanks a lot for giving me idea. Now I am successfully able to do the messaging cluster in production environment.

                     

                    Regards,

                    Jonbon Dash