1 2 Previous Next 16 Replies Latest reply on May 22, 2012 10:51 PM by jaikiran pai

    Clustered EJB configuration

    Prasad Deshpande Expert

      Hi Guys,

       

      I've setup a cluster of 2 nodes (say Node-A & Node-B) & have ear deployed on both (standalone configuration) nodes, ear has couple of stateful clustered ejb's. Now on Node-A, from the WAR in EAR, I initialise one of clustered stateful ejb, so I can assume that state is replicated to Node-B & B has the same ejb state. Then I kill Node-A, & try to perform further operation on clustered stateful bean from servlet in WAR on Node-B, it fails saying java.lang.IllegalStateException: EJBCLIENT000027: No EJBReceiver available for node name slave1

       

      Now, since configuration is clustered, I assume that I don't need to configure remote-outbound-connection on all nodes (should be discovered automatically) that will be part of cluster or do I? If my assumption is right what exactly could I be missing? If my assumption is wrong, what do I need to do?

       

      Thanks,

      Prasad

        • 1. Re: Clustered EJB configuration
          jaikiran pai Master

          Can you post the entire exception stacktrace?

          • 2. Re: Clustered EJB configuration
            Prasad Deshpande Expert

            java.lang.IllegalStateException: EJBCLIENT000027: No EJBReceiver available for node name master

            org.jboss.ejb.client.EJBClientContext.requireNodeEJBReceiver(EJBClientContext.java:611)

            org.jboss.ejb.client.EJBClientContext.requireNodeEJBReceiverContext(EJBClientContext.java:646)

            org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:68)

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

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

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

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

            $Proxy120.getPageSize(Unknown Source)

            com.banctec.caseware.client.api.ListAPI.getList(ListAPI.java:507)

            • 3. Re: Clustered EJB configuration
              Radoslav Husar Master

              Prasad,

              I dont see anything obvious. Make sure you are using latest 7.1.2 / 7.2.0-SNAPSHOT build and that you are running HA profile (standalone-ha.xml or so) and the cluster connected up.

               

              How are you calling the EJB bean though, what does the code look like? Look at this minimal sample where @LocalBean @Stateful EJB is injected with CDI @Inject into a Servlet which works like a charm including session replication and failover ;-)

               

              https://github.com/rhusar/clusterbench/blob/master/clusterbench-ee6-ejb/src/main/java/org/jboss/test/clusterbench/ejb/stateful/LocalStatefulSB.java

              https://github.com/rhusar/clusterbench/blob/master/clusterbench-ee6-web/src/main/java/org/jboss/test/clusterbench/web/ejb/LocalEjbServlet.java

               

              HTH,

              Rado

              • 4. Re: Clustered EJB configuration
                jaikiran pai Master

                Looking at that stacktrace you are having a non-clustered SFSB which is pinned to a specific node. What does your bean code and configuration(s) look like? And are you sure you are starting the standalone-ha.xml profile?

                • 5. Re: Clustered EJB configuration
                  Prasad Deshpande Expert

                  Bean has @Stateful annotation on it, but I've spcified following in jboss-ejb3.xml for ejb.jar

                   

                  <jboss xmlns="http://www.jboss.com/xml/ns/javaee" xmlns:jee="http://java.sun.com/xml/ns/javaee" xmlns:c="urn:clustering:1.0">

                      <jee:assembly-descriptor>

                          <c:clustering>

                              <jee:ejb-name>XXXXXX</jee:ejb-name>

                              <c:clustered>true</c:clustered>

                          </c:clustering>

                          <c:clustering>

                              <jee:ejb-name>YYYYYY</jee:ejb-name>

                              <c:clustered>true</c:clustered>

                          </c:clustering>

                          <c:clustering>

                              <jee:ejb-name>ZZZZZ</jee:ejb-name>

                              <c:clustered>true</c:clustered>

                          </c:clustering>

                      </jee:assembly-descriptor>

                  </jboss>

                   

                  & we are talking here about bean YYYYY, so, I'd imagin I should have stateful bean ready for clustering.

                   

                   

                   

                  I'm not running per say standalone-ha.xml but I've enabled infinispan, modcluster & jgroups subsystems which are required for clustering (I hope I'm right again in my assumption). But I take your point, have a look at socket-binding-group

                   

                  For Node-A

                   

                  <socket-binding-group name="standard-sockets" default-interface="any" port-offset="${jboss.socket.binding.port-offset:0}">
                      <socket-binding name="ajp" port="8009"/>
                      <socket-binding name="http" port="8080"/>
                      <socket-binding name="https" port="8443"/>
                      <socket-binding name="jgroups-diagnostics" port="0" multicast-address="224.0.75.75" multicast-port="7500"/>
                      <socket-binding name="jgroups-mping" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>
                      <socket-binding name="jgroups-tcp" port="7600"/>
                      <socket-binding name="jgroups-tcp-fd" port="57600"/>
                      <socket-binding name="jgroups-udp" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
                      <socket-binding name="jgroups-udp-fd" port="54200"/>
                      <socket-binding name="modcluster" port="0" multicast-address="224.0.1.105" multicast-port="23364"/>
                      <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
                      <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
                      <socket-binding name="messaging" port="5445"/>
                      <socket-binding name="messaging-throughput" port="5455"/>
                      <socket-binding name="remoting" port="4447"/>
                      <socket-binding name="txn-recovery-environment" port="4712"/>
                      <socket-binding name="txn-status-manager" port="4713"/>
                  </socket-binding-group>

                   

                  Node-B

                   

                  <socket-binding-group name="standard-sockets" default-interface="any" port-offset="${jboss.socket.binding.port-offset:150}">
                      <socket-binding name="ajp" port="8009"/>
                      <socket-binding name="http" port="8080"/>
                      <socket-binding name="https" port="8443"/>
                      <socket-binding name="jgroups-diagnostics" port="0" multicast-address="224.0.75.75" multicast-port="7500"/>
                      <socket-binding name="jgroups-mping" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>
                      <socket-binding name="jgroups-tcp" port="7600"/>
                      <socket-binding name="jgroups-tcp-fd" port="57600"/>
                      <socket-binding name="jgroups-udp" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
                      <socket-binding name="jgroups-udp-fd" port="54200"/>
                      <socket-binding name="modcluster" port="0" multicast-address="224.0.1.105" multicast-port="23364"/>
                      <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
                      <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
                      <socket-binding name="messaging" port="5445"/>
                      <socket-binding name="messaging-throughput" port="5455"/>
                      <socket-binding name="remoting" port="4447"/>
                      <socket-binding name="txn-recovery-environment" port="4712"/>
                      <socket-binding name="txn-status-manager" port="4713"/>
                  </socket-binding-group>

                   

                  The only reason I can see is because of port-offset I've specified in Node-B, but if I don't specify that I can't run both these instances on same machine (unless I define another socket-binding-group just for jgroups), or if you know any other trick..

                  • 6. Re: Clustered EJB configuration
                    Prasad Deshpande Expert

                    Rado, I'm running on nightly 7.1.2 build on 9th May.

                    • 7. Re: Clustered EJB configuration
                      jaikiran pai Master

                      I'm not too sure you have the custom standalone configuration correct (for example the EJB3 subsystem). I would recommend that you take a look at the standalone-ha.xml and see if you find something missing from your custom configuration. If not, please attach that config file.

                      • 8. Re: Clustered EJB configuration
                        Prasad Deshpande Expert

                        Yeah, right, there were some differences in EJB3 susbsystems since I last synchronised it (specially with clustered-cache-ref in <cache> & modules in <cache-container>).. It worked after synchronisation. Thanks for that Jaikiran.

                        • 9. Re: Clustered EJB configuration
                          Prasad Deshpande Expert

                          Just to continue on same Jaikiran, do I need to have something special in jboss-ejb-client.properties for remote client to failover to another node in the cluster? I have following:

                           

                          remote.connections=efp

                          remote.connection.efp.host=localhost

                          remote.connection.efp.port = 4447

                           

                          I know that documentation says specifying any node is enough.. so it's clearly something that I'm missing here..

                           

                          just to be clear, what I'm accessing is SLSB from remote client & currently when I kill node-A running on 4447, I get EJBCLIENT000025: No EJB receiver available for handling [appName:efp, moduleName:efprocess, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@72433b8a. I'd expect connnection to be failover to Node-B.  Any clue on what am I missing? Any cluster specific properties?

                           

                          anything specified in https://github.com/jbossas/jboss-ejb-client/blob/master/src/test/resources/ejb-client-configuration.properties?

                          Also, is "remote.clusters" name something that we specify on server-side in configuration?

                          what is a purpose of "remote.cluster.foo-cluster.clusternode.selector"?

                          • 10. Re: Clustered EJB configuration
                            Radoslav Husar Master

                            For SLSB you do need to specify

                             

                            remote.clusters=ejb

                             

                            or take a look at the sample configuration

                            https://github.com/jbossas/jboss-as/blob/master/testsuite/integration/clust/src/test/resources/cluster/ejb3/stateless/jboss-ejb-client.properties#L32

                            (as fixed in AS7-3848)

                             

                            SFSB sends complete topology information so this is not needed.

                            • 11. Re: Clustered EJB configuration
                              jaikiran pai Master

                              Actually it doesn't matter if the bean is SFSB or SLSB. The remote.clusters and the remote.cluster.foo.xxx properties are used for auto connecting to the nodes in the cluster. So appropriate configurations for those are necessary for successful cluster communication. More details on what those configurations are can be found in this post https://community.jboss.org/message/724581#724581

                              • 12. Re: Clustered EJB configuration
                                Prasad Deshpande Expert

                                No, still doesn't work for me.. this is what I've got in jboss-ejb-client.properties

                                 

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

                                remote.connections=efp

                                remote.connection.efp.host=localhost

                                remote.connection.efp.port = 4447

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

                                remote.clusters=ejb

                                • 13. Re: Clustered EJB configuration
                                  jaikiran pai Master

                                  Prasad Deshpande wrote:

                                   

                                  remote.clusters=ejb

                                  You haven't specified the connection configurations to use for that cluster named "ejb". You have just declared the cluster name here. So it should be something like:

                                   

                                  remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
                                  remote.connections=efp
                                  remote.connection.efp.host=localhost
                                  remote.connection.efp.port = 4447
                                  remote.connection.efp.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
                                  
                                  # Declare the cluster(s)
                                  remote.clusters=ejb
                                  
                                  # Connection configuration(s) for the "ejb" cluster (these are just random examples. You might have to add username and password
                                  # or callbackhandler depending on the security configuration(s) of these cluster node servers.
                                  remote.cluster.ejb.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
                                  remote.cluster.ejb.connect.options.org.xnio.Options.SSL_ENABLED=false
                                  
                                  
                                  
                                  1 of 1 people found this helpful
                                  • 14. Re: Clustered EJB configuration
                                    Prasad Deshpande Expert

                                     

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

                                    Ahh.. so I still have to specify that for clusteres.. ok, will keep in mind, thanks!

                                     

                                    I ran it with this configuration & it worked..

                                    1 2 Previous Next