7 Replies Latest reply on Apr 24, 2013 3:26 AM by jahoshai

    Problem with EJB clustering on 7.1.3

    jahoshai

      I have setup a cluster of two nodes running on domain mode.

      I am trying to deploy my stateless EJBs to the cluster. EJBs are annotated with @org.jboss.ejb3.annotation.Clustered.

       

      On invoking remote ejb calls I am getting following error

       

      EJBCLIENT000025: No EJB receiver available for handling [appName:sdpApp, moduleName:platform-ejb, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@4fa4ded3

       

      java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:myApp, moduleName:platform-ejb, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@4fa4ded3

      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:183)

      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 $Proxy6.checkPermissions(Unknown Source)

      at com.sdp.core.remote.RemoteAuthzTest.testCheckPermissions(RemoteAuthzTest.java:37)

       

      The following properties have been added to jboss-ejb-client.properties

       

      remote.clusters=ejb

      remote.cluster.ejb.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

      remote.cluster.ejb.clusternode.selector=org.jboss.ejb.client.RandomClusterNodeSelector

      remote.cluster.ejb.connect.options.org.xnio.Options.SSL_ENABLED=false

       

       

      Looking at the server log I can see web based cluster being started but I dont see any info regarding ejb cluster.

      I am using EJB3 subsystem configuration out of the box.

       

      <subsystem xmlns="urn:jboss:domain:ejb3:1.3">

                      <session-bean>

                          <stateless>

                              <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>

                          </stateless>

                          <stateful default-access-timeout="5000" cache-ref="simple" clustered-cache-ref="clustered"/>

                          <singleton default-access-timeout="5000"/>

                      </session-bean>

                      <mdb>

                          <resource-adapter-ref resource-adapter-name="hornetq-ra"/>

                          <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>

                      </mdb>

                      <pools>

                          <bean-instance-pools>

                              <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>

                              <strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>

                          </bean-instance-pools>

                      </pools>

                      <caches>

                          <cache name="simple" aliases="NoPassivationCache"/>

                          <cache name="passivating" passivation-store-ref="file" aliases="SimpleStatefulCache"/>

                          <cache name="clustered" passivation-store-ref="infinispan" aliases="StatefulTreeCache"/>

                      </caches>

                      <passivation-stores>

                          <file-passivation-store name="file"/>

                          <cluster-passivation-store name="infinispan" cache-container="ejb"/>

                      </passivation-stores>

                      <async thread-pool-name="default"/>

                      <timer-service thread-pool-name="default">

                          <data-store path="timer-service-data" relative-to="jboss.server.data.dir"/>

                      </timer-service>

                      <remote connector-ref="remoting-connector" thread-pool-name="default"/>

                      <thread-pools>

                          <thread-pool name="default">

                              <max-threads count="10"/>

                              <keepalive-time time="100" unit="milliseconds"/>

                          </thread-pool>

                      </thread-pools>

                      <iiop enable-by-default="false" use-qualified-name="false"/>

                  </subsystem>

       

       

      And below is my infinispan subsystem configuration

       

      <subsystem xmlns="urn:jboss:domain:infinispan:1.3">

                      <cache-container name="cluster" aliases="ha-partition" default-cache="default">

                          <transport lock-timeout="60000"/>

                          <replicated-cache name="default" mode="SYNC" batching="true">

                              <locking isolation="REPEATABLE_READ"/>

                          </replicated-cache>

                      </cache-container>

                      <cache-container name="web" aliases="standard-session-cache" default-cache="repl" module="org.jboss.as.clustering.web.infinispan">

                          <transport lock-timeout="60000"/>

                          <replicated-cache name="repl" mode="ASYNC" batching="true">

                              <file-store/>

                          </replicated-cache>

                          <replicated-cache name="sso" mode="SYNC" batching="true"/>

                          <distributed-cache name="dist" mode="ASYNC" batching="true" l1-lifespan="0">

                              <file-store/>

                          </distributed-cache>

                      </cache-container>

                      <cache-container name="ejb" aliases="sfsb sfsb-cache" default-cache="repl" module="org.jboss.as.clustering.ejb3.infinispan">

                          <transport lock-timeout="60000"/>

                          <replicated-cache name="repl" mode="ASYNC" batching="true">

                              <eviction strategy="LRU" max-entries="10000"/>

                              <file-store/>

                          </replicated-cache>

                          <!--

                            ~  Clustered cache used internally by EJB subsytem for managing the client-mapping(s) of

                            ~                 the socketbinding referenced by the EJB remoting connector

                            -->

                          <replicated-cache name="remote-connector-client-mappings" mode="SYNC" batching="true"/>

                          <distributed-cache name="dist" mode="ASYNC" batching="true" l1-lifespan="0">

                              <eviction strategy="LRU" max-entries="10000"/>

                              <file-store/>

                          </distributed-cache>

                      </cache-container>

                      <cache-container name="hibernate" default-cache="local-query" module="org.jboss.as.jpa.hibernate:4">

                          <transport lock-timeout="60000"/>

                          <local-cache name="local-query">

                              <transaction mode="NONE"/>

                              <eviction strategy="LRU" max-entries="10000"/>

                              <expiration max-idle="100000"/>

                          </local-cache>

                          <invalidation-cache name="entity" mode="SYNC">

                              <transaction mode="NON_XA"/>

                              <eviction strategy="LRU" max-entries="10000"/>

                              <expiration max-idle="100000"/>

                          </invalidation-cache>

                          <replicated-cache name="timestamps" mode="ASYNC">

                              <transaction mode="NONE"/>

                              <eviction strategy="NONE"/>

                          </replicated-cache>

                      </cache-container>

                  </subsystem>

        • 1. Re: Problem with EJB clustering on 7.1.3
          jaikiran

          The jboss-ejb-client.properties doesn't come into play if you are doing server to server invocations. You need a jboss-ejb-client.xml for configuring the same. Take a look at the jboss-ejb-client xsd available in JBOSS_HOME/docs/schema folder for how to configure the clustering part.

          • 2. Re: Problem with EJB clustering on 7.1.3
            jahoshai

            I am doing client to server invocation.

            • 3. Re: Problem with EJB clustering on 7.1.3
              jaikiran

              Are you starting the servers using the *ha.xml profiles? And are you running the multiple server instances on a single machine? If yes, have you set a unique jboss.node.name system property for each of the server instances?

              • 4. Re: Problem with EJB clustering on 7.1.3
                jahoshai

                I am running my servers on domain mode and using ha-full profile. I have server instances running on different machines. Currently I have bring down one node and currently trying to run on single node itself.

                 

                With servers using ha-full profile running, if I start other server instance running on full profile the request goes to the server that is not part of cluster.

                Thats the reason I doubht whether my ejb cluster has started.

                 

                Complete configuration of jboss-ejb-client.properties

                 

                endpoint.name=client-endpoint

                remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

                 

                remote.connections=default

                remote.connection.default.host=10.106.8.121

                remote.connection.default.port = 4447

                remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

                remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false

                remote.connection.default.username=superadmin

                remote.connection.default.password=superadmin

                  

                remote.clusters=ejb

                remote.cluster.ejb.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

                remote.cluster.ejb.clusternode.selector=org.jboss.ejb.client.RandomClusterNodeSelector

                remote.cluster.ejb.connect.options.org.xnio.Options.SSL_ENABLED=false

                • 5. Re: Problem with EJB clustering on 7.1.3
                  jaikiran

                  Jahoorulla Shaik wrote:

                   

                   

                  With servers using ha-full profile running, if I start other server instance running on full profile the request goes to the server that is not part of cluster.

                  Thats the reason I doubht whether my ejb cluster has started.

                   

                  That doesn't mean the clustering topology hasn't been considered. The "pinning" to a cluster happens on if there's a hard affinity associated with the proxy. Take a look at this chapter for more details https://docs.jboss.org/author/display/AS71/Clustered+EJBs

                   

                  What exactly does your client code look like?

                  • 6. Re: Problem with EJB clustering on 7.1.3
                    jahoshai

                    private static Context getContext() throws Exception

                        {

                     

                            if (ctx == null)

                            {

                                Hashtable<Object, Object> ht = new Hashtable<Object, Object>();

                                ht.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

                                ctx = new InitialContext(ht);

                            }

                     

                            return ctx;

                        }

                     

                     

                    public static Object getRemoteBean(String beanName)

                        {

                            Object obj;

                            try

                            {

                                beanName = "ejb:myApp/platform-ejb//"+beanName.split("#")[0]+"!"+beanName.split("#")[1];

                                obj = getContext().lookup(beanName);

                               

                            }

                            catch (Exception e)

                            {

                                throw new RuntimeException(e);

                            }

                            return obj;

                        }

                    • 7. Re: Problem with EJB clustering on 7.1.3
                      jahoshai

                      Now I am able to make invocation to the server from client. The problem was I missed out the port offset given for the server I was starting.

                       

                      But now failover doesnt seem to happen.

                      I am running with two nodes on cluster and while making the remote invocations to node1, if I bring down node1 the requests doesnt get routed to node2.

                      I get No EJB receiver available for handling error.

                       

                      I have gone through other thread discussing about similar issue. But it dint helped in resolving the issue.

                       

                       

                      Thanks,

                      Shaik