8 Replies Latest reply on Jun 4, 2013 2:44 AM by phischne

    Server to server remote ejb invokation with explicit host

    phischne

      At first i would like to describe the environment: We run a few instances of JBoss 7 AS in standalone mode. The same set of EJBs (all implementing the same remote interface) is deployed on every Server.

      What i need right now is the ability to invoke enterprise beans from any instance on any other. The application will select the server to execute the bean at runtime.

      I tried the java SE approach  ("EJB invocations from a remote client using JNDI") from the JBoss 7 developer guide which fails with "SecurityException: EJB client context selector may not be changed". Obviously this is not the way it should be done.

      By then i noticed the "EJB invocations from a remote server instance" chapter right next to the SE instructions. However i couldn't find any parameter to specify the destintation server from within the calling application.

      Now to my question: Is there a way for an J2EE Application running inside the JBoss 7 server  to invoke a remote interface on an random server ?

      Thanks in advance !

        • 1. Re: Server to server remote ejb invokation with explicit host
          jaikiran

          Philipp, welcome to the forums!

           

          Which version are you using?

          • 2. Re: Server to server remote ejb invokation with explicit host
            phischne

            The server identifies itself by JBoss AS 7.1.1.Final "Brontes"

            • 3. Re: Server to server remote ejb invokation with explicit host
              jaikiran

              WildFly 8.0.0.Alpha1 (which is the project rename of JBoss AS) has been released and that version has the feature where you can dynamically pass in any server name/IP to the JNDI context to lookup and invoke on the EJBs. Here's the documentation https://docs.jboss.org/author/display/WFLY8/Scoped+EJB+client+contexts. Is that something you want to give a try? This however, isn't available in AS7 versions.

              • 4. Re: Server to server remote ejb invokation with explicit host
                phischne

                Well, as developer there is nothing i would   like more than download WildFly 8 and start using exacty the feature i miss. Sadly i don't expect WildFly 8 to even go beta before we have to be live. Migration to JBoss 7 was already a huge step and a lot of persuasion work to do

                • 5. Re: Server to server remote ejb invokation with explicit host
                  jaikiran

                  Okay, in that case let's see if we can get something working on AS7 then and that depends on what you are expecting:

                   

                   

                  Philipp Schneider wrote:

                   

                  At first i would like to describe the environment: We run a few instances of JBoss 7 AS in standalone mode. The same set of EJBs (all implementing the same remote interface) is deployed on every Server.

                  What i need right now is the ability to invoke enterprise beans from any instance on any other. The application will select the server to execute the bean at runtime.

                  ...

                  Now to my question: Is there a way for an J2EE Application running inside the JBoss 7 server  to invoke a remote interface on an random server ?

                   

                  So you have S1, S2, S3 ... Sn servers all of which host the same (implementation) of the bean? And you want to decide at runtime which of the server gets picked up if (for example) you invoked from S2 (as a client)?

                   

                  Are all the servers S1 through Sn known in advance? What's the reason for selecting a specific server if all of them host the same EJB implementation?

                  • 6. Re: Server to server remote ejb invokation with explicit host
                    phischne

                    All instances host exactly the same code. The system communicates with backend servers via JMS, sending messages direcly and receiving the responses through the "famous" wmq.jmsra.rar resource adapter. All servers host resource adapters and there is no guarantee the answer will be fetched to the same system as the request originated. At the same time there is an unpleasent amount of state data stored in singelton beans - too much to go into a cluster config and pump everything through the database. However, there is a table in the database connecting the JMS correlation Id to the server responsible for processing the response. So, when the resource adapter spits out a message the application looks up the host which transmitted the request and should forward it unless its the local machine. This routing mechanism is not my doing ... legacy.

                    The number of machines is known at deploy time  and is also not expected to change.

                    • 7. Re: Server to server remote ejb invokation with explicit host
                      claudio4j

                      Probably what you want is written in "Create a outbound-socket-binding on the Client Server" section ?

                      You can specify the destination server in the "host" attribute.

                       

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

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

                      </outbound-socket-binding>

                      • 8. Re: Server to server remote ejb invokation with explicit host
                        phischne

                        I'm afraid this will not be sufficiant. As mentioned in the initial posting i'm aware of the possibilites shown in the "EJB invocations from a remote server instance"-guide. This includes the configuration of

                        outbound-socket-binding as well as remote-outbound-connection. But this does not give me the freedom to select the target host dynamic on every invokation. The session beans have the same name on all servers.