7 Replies Latest reply on Dec 3, 2014 7:31 AM by vithun.v

    Not able to make distributed stateless session bean calls.

    vithun.v

      I run a wildfly environment with a modified standalone-ha cofiguration. I use a Singleton Service to decide the master (Is this the recommended practice?). This master would want to call ejb method remotely on other nodes (from a service kind of thread). I face a problem that, though I expect a remote call here, calls always happen in the local node and doesn't get to other nodes.

       

      I tried to attach wildfly and jboss-ejb-client-2.0.1.Final.jart source to debug the issue and noticed that the following field has only the local EJB receiver always even if I have multiple HA standalone servers active.

       

      public final class org.jboss.ejb.client.EJBClientContext{

           ...

           private final Map<EJBReceiver, ReceiverAssociation> ejbReceiverAssociations = new IdentityHashMap<EJBReceiver, ReceiverAssociation>();

           ...

      }

       

      Note: On JGroups (and Infinispan), the nodes are aware of each other.

       

      Could you please point me to the configration areas that I have to look at to troubleshoot this issue. (And excuse me if I have done something stupid).

       

      PS:I use wildfly 8.1

        • 1. Re: Not able to make distributed stateless session bean calls.
          pferraro

          Have you followed the documentation here?

          EJB invocations from a remote server instance - WildFly 8 - Project Documentation Editor

          EJB Services - WildFly 8 - Project Documentation Editor

           

          On the "EJB services" page, ignore the "Marking an EJB as clustered" section - this is obsolete (I'll fix that).  EJBs are always "clusterable", unless otherwise specified, if deployed within the context of a server started with an ha-capable profile.

          • 2. Re: Not able to make distributed stateless session bean calls.
            vithun.v

            Thanks Paul, I assume the configuration based remoting limits the execution to the set of servers configured as Outbound . Could I configure remoting to all my mutlicast group in a distributed sense, or should I add the server enteries using API.

            • 3. Re: Re: Not able to make distributed stateless session bean calls.
              vithun.v

              https://docs.oracle.com/javaee/7/tutorial/doc/ejb-intro004.htm

               

              Quoting from reference

               

              To create an enterprise bean that allows remote access, you must either

               

                  Decorate the business interface of the enterprise bean with the @Remote annotation:

               

                  @Remote public interface InterfaceName { ... }

               

                  Or decorate the bean class with @Remote, specifying the business interface or interfaces:

               

                  @Remote(InterfaceName.class) public class BeanName implements InterfaceName { ... }

               

              I think I faced issues with clustering when I go for the first approach..

              • 4. Re: Not able to make distributed stateless session bean calls.
                pferraro

                We have tests that validate that this works - so there must be some misconfiguration on your end.  Can you post the problematic code?

                • 5. Re: Not able to make distributed stateless session bean calls.
                  vithun.v

                  Sorry Paul, I by mistake infered that way.

                   

                  However I am still facing this issue, not sure why this happens..

                   

                  I have two nodes and I'm Posting my config file below, both the nodes have the same configuration file..

                   

                  ====================================

                  <?xml version='1.0' encoding='UTF-8'?>

                   

                  <server xmlns="urn:jboss:domain:2.1">

                      <extensions>

                          <extension module="org.jboss.as.clustering.infinispan"/>

                          <extension module="org.jboss.as.clustering.jgroups"/>

                          <extension module="org.jboss.as.connector"/>

                          <extension module="org.jboss.as.deployment-scanner"/>

                          <extension module="org.jboss.as.ee"/>

                          <extension module="org.jboss.as.ejb3"/>

                          <extension module="org.jboss.as.jacorb"/>

                          <extension module="org.jboss.as.jaxrs"/>

                          <extension module="org.jboss.as.jdr"/>

                          <extension module="org.jboss.as.jmx"/>

                          <extension module="org.jboss.as.jpa"/>

                          <extension module="org.jboss.as.jsf"/>

                          <extension module="org.jboss.as.jsr77"/>

                          <extension module="org.jboss.as.logging"/>

                          <extension module="org.jboss.as.mail"/>

                          <extension module="org.jboss.as.messaging"/>

                          <extension module="org.jboss.as.modcluster"/>

                          <extension module="org.jboss.as.naming"/>

                          <extension module="org.jboss.as.pojo"/>

                          <extension module="org.jboss.as.remoting"/>

                          <extension module="org.jboss.as.sar"/>

                          <extension module="org.jboss.as.security"/>

                          <extension module="org.jboss.as.transactions"/>

                          <extension module="org.jboss.as.webservices"/>

                          <extension module="org.jboss.as.weld"/>

                          <extension module="org.wildfly.extension.batch"/>

                          <extension module="org.wildfly.extension.io"/>

                          <extension module="org.wildfly.extension.undertow"/>

                      </extensions>

                      <management>

                          ...

                            <security-realm name="ejb-security-realm">

                                  <server-identities>

                                      <secret value="dGVzdA=="/>

                                  </server-identities>

                              </security-realm>

                       

                            ...

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

                              ...

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

                                 ...

                         </subsystem>

                         ....

                         <subsystem xmlns="urn:jboss:domain:remoting:2.0">

                              <endpoint worker="default"/>

                              <http-connector name="http-remoting-connector" connector-ref="default"/>

                              <outbound-connections>

                                  <remote-outbound-connection name="remote-ejb-connection" outbound-socket-binding-ref="remote-ejb" protocol="http-remoting" security-realm="ejb-security-realm" username="ejb">

                                      <properties>

                                          <property name="SASL_POLICY_NOANONYMOUS" value="false"/>

                                          <property name="SSL_ENABLED" value="false"/>

                                      </properties>

                                  </remote-outbound-connection>

                              </outbound-connections>

                          </subsystem>

                          ...

                      <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">

                          ...

                          <outbound-socket-binding name="remote-ejb">

                              <remote-destination host="localhost" port="8080"/>

                          </outbound-socket-binding>

                      </socket-binding-group>

                  </server>

                   

                  ===================================

                   

                  My jboss-ejb-client file

                   

                  <jboss-ejb-client xmlns="urn:jboss:ejb-client:1.2">

                      <client-context deployment-node-selector="com.vithun.test.DepNodeSeletorX"> <!--every time I get only single node in the callback even if I have two nodes in the cluster -->

                          <ejb-receivers>

                              <remoting-ejb-receiver outbound-connection-ref="remote-ejb-connection"/>

                          </ejb-receivers>

                    <clusters>

                  <!-- cluster of remote-ejb-connection-1 -->

                  <cluster name="ejb" security-realm="ejb-security-realm" username="admin">

                  <connection-creation-options>

                  <property name="org.xnio.Options.SSL_ENABLED" value="false" />

                  <property name="org.xnio.Options.SASL_POLICY_NOANONYMOUS" value="false" />

                  </connection-creation-options>

                  </cluster>

                  </clusters>

                      </client-context>

                  </jboss-ejb-client>

                  ====================

                   

                  However, I notice that when I give the IP of each other node in remote-ejb host, I get the calls distributed sometimes and sometime it gets distribued only on a single node.

                   

                          ...

                          <outbound-socket-binding name="remote-ejb">

                              <remote-destination host="!!IP OF OTHER NODE!!!" port="8080"/>

                          </outbound-socket-binding>

                   

                   

                  Expectation is that, I should get the calls distributed automatically without explicitly specifying every other IP.

                   

                   

                  PS: How do I transfer the caller principal to a remote call ( the one obtained from FORM login). I always get annonymous at the other end.

                  • 6. Re: Not able to make distributed stateless session bean calls.
                    vithun.v

                    Please confirm my assumption.

                     

                    1) When I give the following outbound config, my server will be looped back as the remote receiver. This initially gets connected during server startup,.

                            <outbound-socket-binding name="remote-ejb">

                                <remote-destination host="localhost" port="8080"/>

                            </outbound-socket-binding>

                    2) The looped back remote receiver communicates cluster toplolgy information to my EJB Client (on the same machine).

                     

                    The real problem I face is that the topology is not getting commuicated to my client.

                    • 7. Re: Not able to make distributed stateless session bean calls.
                      vithun.v

                      Thanks Paul for the help. I was able to manage it to get working

                       

                      What are went wrong in my config

                       

                      1) Initially my issue was that, since http connector was used, the server was bound to port x.x.x.x and not 0.0.0.0. For this reason, the following didn't work

                          <outbound-socket-binding name="remote-ejb">

                                  <remote-destination host="localhost" port="8080"/>

                              </outbound-socket-binding>

                      2) I then bound http to 0.0.0.0, but then org.jboss.ejb.client.remoting,ClientMapping was recognizing the other target (destinationAddress) as 0.0.0.0 and didn't work as expected.

                      3) When I try giving my own IP i.e, X.X.X.X for remote ejb, a local receiver gets registered.

                          <outbound-socket-binding name="remote-ejb">

                                  <remote-destination host="X.X.X.X" port="8080"/>

                              </outbound-socket-binding>

                      Local EJB receiver didn't update me about the clsuter toplogy for some reason.

                      4) Now when I disable local EJB receiver, things work.

                      <ejb-receivers exclude-local-receiver="true">

                       

                      I understand the LocalEJBReceiver itself should have worked. I'm checking whats wrong in my congig that makes it go wrong. Meanwhile, please let me know if there is a known limitation.