-
1. Re: Help!! Clustered Nested Session Beans?
wdfink Dec 8, 2010 10:04 AM (in response to foutjo)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?
foutjo Dec 8, 2010 1:15 PM (in response to wdfink)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?