3 Replies Latest reply on Jan 9, 2004 9:19 AM by Jean-MarcSpaggiari

    Clustering + Client Threads

    Paulo Henrique Newbie

      Hi everybody,

      I'm trying to use Clustering but I'm running into some problems. I use jboss-3.0.3 with tomcat-4.1.12 and the default configuration for clistering and farming. I'm using HA-JNDI as well.

      What I'm doing:

      Just after I call the create() of my EJB (Stateless Session EJB), I start several threads, each one calling once the remote method of the EJB. I mean: 1 call to create() then several calls to remoteMethod() in separate threads.

      The problem is:

      When I do it from a standalone Java client for the EJB, it works fine and I can see the RoundRobin. But when I do it from a Servlet, only one JBoss server is called (the same that runs the Servlet), that is, the cluster doesn't work properly.

      Any idea why??? Is there a solution for this? (I can't use a standalone client)

      I'm sending some source code below...

      Thanks in advance!


      --------- Source Code ------------

      * Method that creates and calls the EJB
      protected void runJob() throws Exception
      ComparisonProcessSrvMgrHome testComparisonBean = null;

      //Look up home interface
      try {
      Properties p = new Properties();

      InitialContext ctx = new InitialContext(p);

      Object objrefComparison = ctx.lookup("ejb/com/cpqd/billing/recon/business/services/comparison/ComparisonProcessSrvMgrBean");

      testComparisonBean = (ComparisonProcessSrvMgrHome) PortableRemoteObject.narrow(objrefComparison,ComparisonProcessSrvMgrHome.class);

      catch (Exception e) {

      final ComparisonProcessSrvMgr comparisonBeanRemote =

      for (int i = 0; i < 100; i++) {

      final int count = i;

      new Thread() {
      public void run() {
      try {
      catch (Exception e) {