Using RemoteNaming for a cluster
bernd.koecke Aug 2, 2012 8:00 AMHello,
I'm trying to call a EJB 3.1 SLSB on JBossAS 7 cluster (7.2.0.Alpha1) with jboss-remote-naming-1.0.4.Final. The call is configured through the InitialContext environment hashtable and there is no node configuration in the jboss-ejb-client.properties. But I can't get the failover and balancing working. The JNDI environment contains the following values:
java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory
java.naming.provider.url=remote://<server1>:4447,remote://<server2>:4447
jboss.naming.client.ejb.context=true
Always the first node is (<server1>) called. When I undeploy the application on server1 I get IllegalStateEcxeptions and after a new lookup, I get NameNotFoundExceptions. Only when server1 is completly down, I get a failover but only when I restart my testclient. It should also work, when I use a new thread for executing the client code, because of the ThreadLocal connection in jboss-remote-naming, but I haven't tested this yet. When I set the following system property
jboss.naming.client.random.server=true
the calls go to both server, but its completly sticky. It changes only which server is asked at the first lookup and again a running server with an undeployed application causes Exceptions when selected. By the way, why is this a system property?
When I use only the jboss-ejb-client lib, I get balancing and failover without any exceptions. It is enough to undeploy the application on one node and the other takes all calls. After deploying the app again both nodes are used again. I wouldn't mind when only the balancing is missing, because most of the time it is very useful that one proxy instance, returned by a lookup, calls allways the same node as long as possible. For example then all logging is found on one server. But the failover without an exception is very nice. Is it possible to get this when I only use/configure remote-naming?
Thanks a lot
Bernd