1 Reply Latest reply on Oct 19, 2010 7:47 AM by Wolf-Dieter Fink

    JBoss 5.0.0 failover

    Vladimir Kiryakov Newbie


      Please can any body help me...

      I run 2 nodes in cluster mode. On which of them i will deployed simple stateless bean:


      import javax.ejb.Stateless;


      import org.jboss.ejb3.annotation.Clustered;


      /** Session Bean implementation class MasterBean */
      public class MasterBean implements IMasterBeanRemote {


          /** Default constructor. */
          public MasterBean() { }


          public void show() {

              int __counter = 1;

              while(true) {          
                  try {
                  } catch (Exception e) { e.printStackTrace(); }



      This is client


      package pckg;


      import java.util.Properties;


      import javax.naming.Context;
      import javax.naming.InitialContext;


      import bean.pckg.IMasterBeanRemote;
      import bean.pckg.MasterBean;


      public class MainCLass {


           * @param args
          public static void main(String[] args) throws Exception {
              while(true) {
                  Properties __connectUtils = new Properties();
                  __connectUtils.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                  __connectUtils.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
                  __connectUtils.put(Context.PROVIDER_URL, "jnp://,");
                  Context __ctx = new InitialContext(__connectUtils);


                  IMasterBeanRemote __iRemote = (IMasterBeanRemote) __ctx.lookup(MasterBean.class.getSimpleName() + "/remote");




      Application is launched on 15th node when I kill her, application is launched on 151st node. But when I again launch 15th and I kill 151st it turns out exception(Can not get connection to server bla bla bla). How to force application to understand that 15th node is already launched?

        • 1. Re: JBoss 5.0.0 failover
          Wolf-Dieter Fink Master

          What you wrote is a endless loop in your SLSB on the server!


          Failover mean NOT that a call move to another server!

          A running call will fail if this note hung up or crash.


          expand your show method to show(String text) { System.out.println(text); }

          Move the loop to your main() and cover __IRemote.show()


          If you start the JBoss instances you should see something like 'Number of new mebers :1 / Number of other members 1' in your JBoss logfiles if the cluster is configured correct.


          If you start your main() the show call should balanced over both nodes and in case of kill or shutdown one all calls will run to the single one.