[jboss-user] [EJB 3.0] - strange behaivor of nonclustered ejb calling clustered ejb
wurzelkuchen
do-not-reply at jboss.com
Tue Aug 26 11:28:59 EDT 2008
Hello,
during my work on a student research project, I noticed a strage behavior.
Following scenario:
EJB1: a not clustered stateless EJB, which calls EJB2 per lookup
| @Stateless
| public class Bean implements BeanLocal, BeanRemote {
| ...
| private Bean2 bean2;
| public void call(){
| Properties properties = new Properties();
| properties.put("java.naming.factory.initial",
| "org.jnp.interfaces.NamingContextFactory");
| properties.put("java.naming.factory.url.pkgs",
| "org.jboss.naming:org.jnp.interfaces");
| properties.put("java.naming.provider.url",
| "192.168.0.52:1100");
| Context context;
| try {
| context = new InitialContext(properties);
| bean2 = (RemoteBean2) context.lookup(Bean2.RemoteJNDIName);
| while(...){
| bean2.doSomething();
| }
| } catch (NamingException e) {
| e.printStackTrace();
| }
| }
|
EJB2: a simple clustered stateless EJB
| @Clustered
| @Stateless
| public class Bean2 implements BeanLocal2, BeanRemote2 {
| ...
| public void doSomwthing(){
| ...
| }
| }
|
So, if I start these Beans like above, Bean2 starts only on one node of my Cluster. If I use port 1099 (normal JNDI instead of HAJNDI), Bean2 starts on different nodes each time I start bean2.doSomething().
I realy don't undestand this behaivior. Why does the use of HA-JNDI lets the bean2 unclustered while the use of JNDI leads to a clustered behaivior? I would understand if HAJNDI leads to a clustered and JNDI to an unclustered behaivior, but the opposite happens.
Does anybody have got a good explanation or at least an idea why?
Best Regards
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4172630#4172630
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4172630
More information about the jboss-user
mailing list