I should make it clear in what follows that I am trying to load balance
the EJBs in an application, not the web side. I know how to set up
clustering. What I can't get to work is distribution of a set of EJBs
across several servers like the following:

                       ------> server1 / EJBs
                      |
      server0 -       |
  JSP/Servlet Based __|
     EJB Client       |
                      |
                      |
                       ------> server2 / EJBs


-----Original Message-----
From: Carroll, Jim 
Sent: Wednesday, January 09, 2002 1:42 PM
To: 'Orion-Interest'
Subject: Distributing EJBs



I have been trying to distribute the same application across several
servers for the purposes of load balancing. The team at Orion seems to
have purposely made this impossible. I am using the
RMIInitialContextFactory from the web container (from a JSP page) in
order to round robbin between two servers. The code is rather simple:

  Properties prop = new Properties;
  prop.put("java.naming.factory.initial",
           "com.evermind.server.rmi.RMIInitialContextFactory");
  prop.put("java.naming.provider.url",
           "ormi://server1/appName");

   ... fill in security credentials ...

  InitialContext ic = new IntialContext(prop);
  BeanHome bh = ic.lookup("EJBName");
  BeanRemote br = bh.create();
  br.invokeMethod();         // this executes on server1

  // Now try to execute it on server2

  prop.put("java.naming.provider.url",
           "ormi://server2/appName");

  InitialContext ic2 = new InitialContext(prop);
  BeanHome bh2 = ic2.lookup("EJBName");
  BeanRemote br2 = bh2.create();
  br2.invokeMethod();         // this ALSO executes on server1

The initial url of the RMIInitialContextFactory is used UNTIL server1
fails. Then server2 will start working (again, for every call).

That someone would always want the same server simply because: 1) they
are withing a (web) container (I'm not sure if this works from a stand
alone client or not either), and 2) the application is the same seems an
absurd assumption on the part of the Orion developers. Is there a way
around this?

Thanks

Reply via email to