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.
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 per.java:1091)
what can be the problem? How it should be done?