3 Replies Latest reply on May 27, 2014 6:41 AM by Fab

    Procedure to do EJB calls from one AS7 instance to another ?

    Fab Newbie

      Hello community.

       

      I know there have been tons of articles and threads on this issue, but I cannot make it work !

       

      Situation:

      Migration from JBoss 5.0 to JBoss 7.

       

      Problem:

      Cannot make EJB calls between 2 instances of AS 7.

       

      Requirement:

      The environment consists of many standalone instances running the same deployment on different geographic locations.

      The JBoss instances need to communicate to each other via EJB calls.

      Each instance has a specific role.

       

      EJB calls have to be done dynamically (programmatically).

      So I cannot use the .properties solutions: all the IPs have to be set programmatically like the good old:

       

      props.put(InitialContext.PROVIDER_URL, "jnp://192.168.1.1:1099");
      
      

       

      Tests:

      Having read and tried all of the proposed solutions (mainly by the very patient jaikiran), articles, threads, JIRA issues like:

       

      https://docs.jboss.org/author/display/AS72/EJB+invocations+from+a+remote+client+using+JNDI

      Remote EJB invocations via JNDI - EJB client API or remote-naming project - JBoss AS 7.1 - Project Documentation Editor

      https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+server+instance (cannot be used as IPs are hardcoded in property files)

      https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6.1/html/Development_Guide/Usin…


      I have tried all possible combinations with the following:

       

      . JBoss AS 7.1.1

      . JBoss EAP 6.1.0 Apha

      using the JNDI method with

      jndiProps.put(Context.PROVIDER_URL, "remote://192.168.1.2:4447");
      
      

      ...dasd099");

       

      . using the EJB Client API with:

      jndiProps.put("remote.connection.default.host","192.168.1.2");
      
      

      ...

       

      . using the scope EJB Context with:

      jndiProps1.put("org.jboss.ejb.client.scoped.context", "true");
      
      

       

      I cannot make a EJB Call from one AS7 to another.

      No problem from a standalone client to AS7.

      But impossible from one instance of AS7 to another.

       

      It really is a blocker for our application.

       

      So do you have a step by step procedure to get around this issue?

      Or is it gonna be fixed / available in future releases of WildFly ?

      All the propositions I've found so far failed in getting it to work.

       

      So in the meatime we will stick to AS 5.0.0 wich is a shame, JBoss 7 seems very appealing.

       

      Thank you for your patience and help!

      Cheers

      Fab

        • 1. Re: Procedure to do EJB calls from one AS7 instance to another ?
          Fab Newbie

          Update:

           

          Got it to work with WildFly 8.0.0-Final !!

          Woohooo!

           

          Example of lookup, using the quickstart ejb-remote example:

          The folowing works perfectly with client -> server 1 AND server 1 -> server 2, great !

           

          jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
          jndiProperties.put("remote.connections", "default");
          jndiProperties.put("remote.connection.default.host", "192.168.1.2");
          jndiProperties.put("remote.connection.default.port", "8080");
          
          jndiProperties.put("remote.connection.default.username", "user");
          jndiProperties.put("remote.connection.default.password","pass");
          
          jndiProperties.put("org.jboss.ejb.client.scoped.context", "true"); // doesn't work without the Scoped Context
          
          InitialContext  context = new InitialContext(jndiProperties);
          
          String name = "ejb:/wildfly-ejb-remote-server-side/CalculatorBean!" + RemoteCalculator.class.getName();
          RemoteCalculator calculator = (RemoteCalculator) context.lookup(name);
          

           

          I just have this message from time to time:

           

          ERROR [org.jboss.remoting.remote.connection] JBREM000200: Remote connection failed: java.io.IOException: An existing connection was forcibly closed by the remote host

           

          Am just a bit worried about using WildFly 8.0.0-Final in production as it was released very recently..

          Cheers, Fab

          • 2. Re: Procedure to do EJB calls from one AS7 instance to another ?
            jaikiran pai Master

            Fab wrote:

            I just have this message from time to time:

             

            1. ERROR [org.jboss.remoting.remote.connection] JBREM000200: Remote connection failed: java.io.IOException: An existing connection was forcibly closed by the remote host 

             

            Am just a bit worried about using WildFly 8.0.0-Final in production as it was released very recently..

            Cheers, Fab

            That seems to be because the server side might be closing the connection. How frequently does it happen and is there a specific pattern when this happens? Like maybe some idle time between the client and the server?

            • 3. Re: Procedure to do EJB calls from one AS7 instance to another ?
              Fab Newbie

              Hello Jaikiran.

               

              Thanks for your attention.

              We've actually put the migration to WF 8 on hold, and still using our good old AS 5.0.0 for the moment.

              Waiting for WF 8 to get a bit older to really start digging into it.

               

              So I cannot answer your question for the moment, I'll come back to you when we will seriously put our heads into WF 8.

               

              A reason why the server side may close the connection?

              Yes, of course there is IDLE time between the 2 instances.

              Is there a "proper" way to deal with IDLE? Like closing the context after each EJB use ?

               

              Thanks again for your patience and attention.

              keep up the good work.

              All the best

              Fab