12 Replies Latest reply on Jul 26, 2011 5:28 AM by ronsen

    JBoss AS6 failover - SFSB Error

    ronsen

      Hello all,

       

      I read in the forum that in JBoss AS 5 an error existed, that caused problems on failover with stateful session beans.

      My problem seems to be the same, I have a client that does a look up to a sfsb. The login here works perfect, but when I try to kill the leading node (the first node that started the cluster) to simulate a failover situation, i get this error:

       

      [CODE]JMX CONNECTION WITH NODE: 127.0.0.1:1190

      Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:

          java.net.ConnectException: Connection refused: connect]

      javax.ejb.NoSuchEJBException: Could not find stateful bean: 5c4o206n-oa143p-gocqh0ck-1-gocqmfly-dj

          at org.jboss.ejb3.cache.infinispan.InfinispanStatefulCache.get(InfinispanStatefulCache.java:402)

          at org.jboss.ejb3.stateful.StatefulInstanceAssociationInterceptor.invoke(StatefulInstanceAssociationInterceptor.java:50)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)....[/CODE]

       

      However, if I kill one of the other nodes the application keeps on running. My lookup:

       

      [CODE]

      Properties env = new Properties();
      env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");

      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");

       

      String bindAddress = System.getProperty("jboss.bind.address",addressConnectionString);

      env.put(Context.PROVIDER_URL, bindAddress);

       

      try {
      ctx = new InitialContext(env);
      bean = (Counter) ctx.lookup("ejb/MGBean");
      return true;

      [/CODE]

       

      Any idea? Thanks in advance,

       

      Greets,

        • 1. Re: JBoss AS6 failover - SFSB Error
          ronsen

          Sorry for the code tags and the table...hope readable anyway

          • 2. Re: JBoss AS6 failover - SFSB Error
            ronsen

            has nobody an idea ?

            • 3. Re: JBoss AS6 failover - SFSB Error
              ronsen

              I have experimented with it and came to the point, that the problem is the not repeated lookup of the bean.

               

              Whenever I login, the bean will be looked up and stored as an obeject. Whenever I need to call a method from that bean, ill just get that object and call the method.

              In case, the "masternode" is killed, this reference is lost and the lookup doesnt re-lookup the bean.

              My solution would be instead of storing a reference, looking up the bean again and again and again... Waht I see here is the problem, that if I e.g. have a cluster of lets say 5 nodes, the lookup goes through 5 nodes(a lookup with a connection string of 5 node addresses) and tries to connect and this definitely takes to long for doing it quite often. I encountered that the lookup tries to connect to all of the nodes, even in cases it already founds a node it can connect to.

               

              Probably my concept is wrong or im doing a mistake somewhere during the lookup?

               

              I'd be happy if somebody has an idea,

               

              thanks in advance,

              • 4. Re: JBoss AS6 failover - SFSB Error
                ronsen

                Resolved, adjusted teh structure to catch failover exceptions and keep refreshing to connect with a list of active nodes to get a new proxy.

                • 5. Re: JBoss AS6 failover - SFSB Error
                  thunder.farmer

                  Hi there,

                   

                  previously I have same understanding as you, but now I find out that's NOT it.

                   

                  The JBoss EJB transparent failover works perfactly....

                   

                  My issue is cluster is  NOT set up correctly....

                  • 6. Re: JBoss AS6 failover - SFSB Error
                    ronsen

                    you sure, even for bigger size clusters and by killing the "leading" node?

                    • 7. Re: JBoss AS6 failover - SFSB Error
                      thunder.farmer

                      Ron K 编写:

                       

                      you sure, even for bigger size clusters and by killing the "leading" node?

                      Yes, I test and verify that.

                       

                      In short, for client transparent failover, client code don't need to try-catch code to recover.

                      • 8. Re: JBoss AS6 failover - SFSB Error
                        ronsen

                        Strange then, I actually expected that, but i dont know then where my mistake is in such a simple lookup.

                         

                        can you show me yours? And explain how and if you cache the object?

                        • 9. Re: JBoss AS6 failover - SFSB Error
                          thunder.farmer

                          Ron K 编写:

                           

                          Strange then, I actually expected that, but i dont know then where my mistake is in such a simple lookup.

                           

                          can you show me yours? And explain how and if you cache the object?

                          I lookup the ejb only once, and use the reomote ejb reference for all the subsequent calls.

                          For your issue, I can think of two concerns,

                          1. make sure the EJB is clustered

                          2. make sure JBoss server cluster are set up correctlly, for safity sake, run jboss server with -b 0.0.0.0

                          • 10. Re: JBoss AS6 failover - SFSB Error
                            ronsen

                            Same do i, i looked it up once and

                            1. use the remote interface

                            2. have made sure that the cluster is set up correctly

                             

                             

                            strange.....do you look it up again whenever you call a method on that bean?

                            • 11. Re: JBoss AS6 failover - SFSB Error
                              thunder.farmer

                              Ron K 编写:

                               

                               

                              strange.....do you look it up again whenever you call a method on that bean?

                              No, I look up the remote refrence only once.

                              you can try your code on jboss 5, jboss 6 isn't good version for production...

                              • 12. Re: JBoss AS6 failover - SFSB Error
                                ronsen

                                ;-) well then, ill try it on 5 and tell you if it works.