2 Replies Latest reply on Dec 8, 2010 1:15 PM by Joseph Fouts

    Help!! Clustered Nested Session Beans?

    Joseph Fouts Novice

      Hi All,

       

      Can a nested session bean be clustered?

       

      Here is my problem.  I have taken the simple hello world cluster test and have gotten it to work on two machines.  A windows xp and a linus box.  The test does exactly what I would expect I see the print statement display on each

      server's console one after the other.

       

      Here is my problem:

       

      Now I change the original session bean to not be clustered and add lookup for a second session bean.  The second bean(hello world 2) is clustered.   The results for this test is that the print statements for both session beans are always displayed on the first server started.  I was expecting the clustered second bean to display on each server one after the other just like the test above.

       

      Can anyone tell me if this can be done or if there is something that I might be doing wrong?   Any help is greatly apprecaited.

       

      **If anyone would like to see my simple test files I can send them to you at your request.

        • 1. Re: Help!! Clustered Nested Session Beans?
          Wolf-Dieter Fink Master

          As far as I understand your deployment ...

          First attempt with SLSB1(clustered) -> work as expected

          Second

          - SLSB1(nonClustered) call SLSB2

          - SLSB2(clustered) only print statement

          - call SLSB1 from client twice with no balancing at all

          - Your client do one JNDI-lookup to SLSB1 and call the print method.

           

          What happen is:

          The lookup get a 'non clustered' proxy to one of the nodes (depends on your jnp parameter)

          If you call this SLSB1 there is no loadbalanceing.

          JBoss optimize the call to SLSB2 and use only the local deployed instance!

           

          If you call SLSB2 from client you will have loadbalanceing.

          • 2. Re: Help!! Clustered Nested Session Beans?
            Joseph Fouts Novice

            When you say the lookup get a 'non clustered' proxy to one of the nodes.  What do you mean when you say it

            depends on jnp parameter?

             

            Here is the code from the client getting the non clustered session bean:

             

            public static void main(String[] args) {
                    try {
                       
                        Properties p = new Properties();  
                        p.put(Context.INITIAL_CONTEXT_FACTORY,  
                             "org.jnp.interfaces.NamingContextFactory");  
                        p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");  
                        p.put(Context.PROVIDER_URL, "10.90.100.2:1099,10.90.100.3:1099,10.90.100.8:1099,10.90.100.7:1099"); 
                                   
                        InitialContext ctx = new InitialContext(p);
                                   
                        MyBeanRemote bean = (MyBeanRemote) ctx.lookup("MyBean/remote");
                   
                       
                        bean.doSomething();
                    } catch (NamingException e) {
                        e.printStackTrace();
                    }

             

                }

             

            Here is the code from the non clustered session bean getting the 2nd clustered session bean:

             

            public void doSomething() {
                    System.out.println("Starting Parent Session Bean");
               
                    Properties p = new Properties();  
                    p.put(Context.INITIAL_CONTEXT_FACTORY,  
                            "org.jnp.interfaces.NamingContextFactory");
                    p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");  
                    p.put(Context.PROVIDER_URL, "10.90.100.2:1099,10.90.100.3:1099,10.90.100.8:1099,10.90.100.7:1099");       

             

                    try
                    {
                        InitialContext ctx = new InitialContext(p);

             

                        ChildBeanRemote bean = (ChildBeanRemote) ctx.lookup("ChildBean/remote");
                        //ChildBeanLocal bean = (ChildBeanLocal) ctx.lookup("ChildBean/local");

             

                        bean.doSomething();     
                    }
                    catch (NamingException e)
                    {
                        e.printStackTrace();
                    }              
                }

             

            I want to get the 2nd session bean to cluster on the multiple servers and I can't.  Any help?