Hi
Please can any body help me...
I run 2 nodes in cluster mode. On which of them i will deployed simple stateless bean:
import javax.ejb.Stateless;
import org.jboss.ejb3.annotation.Clustered;
/** Session Bean implementation class MasterBean */
@Stateless
@Clustered
public class MasterBean implements IMasterBeanRemote {
/** Default constructor. */
public MasterBean() { }
@Override
public void show() {
int __counter = 1;
while(true) {
try {
Thread.sleep(1000);
System.out.println(__counter++);
} catch (Exception e) { e.printStackTrace(); }
}
}
}
This is client
package pckg;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import bean.pckg.IMasterBeanRemote;
import bean.pckg.MasterBean;
public class MainCLass {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
System.out.println("start");
while(true) {
Properties __connectUtils = new Properties();
__connectUtils.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
__connectUtils.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
__connectUtils.put(Context.PROVIDER_URL, "jnp://10.38.62.15:1100,10.38.62.151:1100");
Context __ctx = new InitialContext(__connectUtils);
IMasterBeanRemote __iRemote = (IMasterBeanRemote) __ctx.lookup(MasterBean.class.getSimpleName() + "/remote");
__iRemote.show();
}
}
}
Application is launched on 15th node when I kill her, application is launched on 151st node. But when I again launch 15th and I kill 151st it turns out exception(Can not get connection to server bla bla bla). How to force application to understand that 15th node is already launched?