2 Replies Latest reply on Apr 3, 2006 11:31 PM by Prabath Pathirana

    Failover and loadbalancing not working for SFSB in JBoss clu

    Prabath Pathirana Newbie

      We have set up a three node cluster and we need to make a Stateful EJB aplication clustered, there. So we developed a stateful session bean and a servlet to access it. These are the steps we followed.

      1. Started three nodes in "all" configuration of JBoss. (They detected each other)

      2. Developed a stateful EJB which produces a Fibonacci series that makes the cpu busy. (Seperate jar)

      3. Developed a client web application seperately running on the server which accesses the EJB. (Servlet)

      4. Added a

      xml entry in jboss.xml.

      5. Made "provider url" in run time as follows

      6. Made the EJB available in every node, and made a request to the master node of the cluster from some other machine in the network which doesn't belong to the cluster.

      7. While the process being running (it takes some time to complete) deleted the EJB from master node to check the failover.
      But the process stopped and it didn't failover.

      8. By making several requests from seperate machines checked the loadbalancing; but only the master node's cpu gets busy. (That means no loadbalancing)

      So what could be the problem?
      The way of making the request,
      The way of testing failover and load balancing
      or any other problem (my reference was "JBoss AS Clustering")

      Please get us to the right track. (we have only few days)

        • 1. Re: Failover and loadbalancing not working for SFSB in JBoss
          Brian Stansberry Master

          Re: load balancing, if you are trying to call a clustered EJB from inside the app server, there is an optimization that is going to force the call to go to the bean deployed in the local node. See this post for more:


          Re: failover, once you've successfully invoked a method on your bean (on the server), if there is a failure it is going to propagate to your client code, not lead to the client side proxy transparently retrying the call on another server. This is because the proxy has no way of knowing if the call was idempotent; maybe invoking it again will screw up your app. Only your own code can make this decision.

          Failover will happen if the proxy is unable to make the call on the server.

          A better test is to do a home lookup, create your SFSB and have your client repeatedly invoke a simple method on it. Have the SFSB log a message every time it's invoked Then while the client is looping and making calls, kill the server it's invoking on. Have your client catch any exception, in case your luck is bad and you kill the server while it's handling a call. You should see the calls fail over to the 2nd node.

          • 2. Re: Failover and loadbalancing not working for SFSB in JBoss
            Prabath Pathirana Newbie

            Thanks for your reply.
            The failover test was done exactly the way you said. That means my client servlet has a loop which calls the bean's method repeatedly. (since stateful it remains the previous one's state as well.) The problem is when i kill the bean (not the server) it is treated as an undeployed bean. Couldn't kill the server itself since the servlet is also deployed there.
            So i tried deploying the bean in one node and the servlet in another node, but it doesn't find the bean instead it shows the following exception.

            08:57:03,324 INFO [STDOUT] javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: project2.interfaces.CountHome (no security manager: RMI class loader disabled)]
            08:57:03,374 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:713)
            08:57:03,374 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
            08:57:03,374 INFO [STDOUT] at javax.naming.InitialContext.lookup(InitialContext.java:347)
            08:57:03,374 INFO [STDOUT] at TestFinal.web.FinalServlet.init(FinalServlet.java:83)
            08:57:03,374 INFO [STDOUT] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrap

            what can be the problem? How it should be done?