2 Replies Latest reply on Aug 6, 2012 6:21 AM by bernd.koecke

    Using RemoteNaming for a cluster

    bernd.koecke

      Hello,

       

      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

        • 1. Re: Using RemoteNaming for a cluster
          jaikiran

          I have to be honest, there are many issues with using remote-naming for EJB invocations. It wasn't really meant to be used for that. But anyway, let's take this one by one. What exact exception do you see when you undeploy the application from server1. Can you post the entire exception stacktrace?

          • 2. Re: Using RemoteNaming for a cluster
            bernd.koecke

            Sure, here is the stacktrace after undeploying the EAR on server1 when there are ongoing calls:

             

            java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:jb7samples-jb7w-e31-v1.0, moduleName:jb7samples-jb7w-e31-beans-v1.0, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@727f3b8a

                at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:588)

                at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:116)

                at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

                at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)

                at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)

                at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)

                at $Proxy0.handleData(Unknown Source)

                at com.oneandone.coredev.swistec.test.jb7samples.jb7wmain.Jb7WorkerMainCaller.callEjb31OnJb7(Jb7WorkerMainCaller.java:210)

                at com.oneandone.coredev.swistec.test.jb7samples.jb7wmain.Jb7WorkerMainCaller.exec(Jb7WorkerMainCaller.java:132)

                at com.oneandone.coredev.swistec.test.jb7samples.jb7wmain.Jb7WorkerMainCaller.main(Jb7WorkerMainCaller.java:294)

             

            And this exception happens when I create a new InitialContext with the same thread:

             

            javax.naming.NameNotFoundException: jb7samples-jb7w-e31-v1.0/jb7samples-jb7w-e31-beans-v1.0/Ejb31Jb7WorkerBean!com.oneandone.coredev.swistec.test.jb7samples.jb7w.e31beans.api.Ejb31Jb7WorkerFacade -- service jboss.naming.context.java.jboss.exported."jb7samples-jb7w-e31-v1.0"."jb7samples-jb7w-e31-beans-v1.0"."Ejb31Jb7WorkerBean!com.oneandone.coredev.swistec.test.jb7samples.jb7w.e31beans.api.Ejb31Jb7WorkerFacade"

                at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)

                at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)

                at org.jboss.naming.remote.protocol.v1.Protocol$1.handleServerMessage(Protocol.java:127)

                at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

                at java.lang.Thread.run(Thread.java:722)