stateless session bean fail over and HA-RMI fail over not wo
duylt Feb 21, 2006 1:50 AMdear all, i have 2 jboss 4.03Ssp1 be configed as cluster. And one stateless session bean with load balance and fail over enable. But it seem to be not work. Stateless bean also deployed in 2 server
this is my ejb-jab.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<display-name>ServerBean</display-name>
<enterprise-beans>
<ejb-name>ejbName</ejb-name>
com.gcs.rmw.server.ServerHome
com.gcs.rmw.server.Server
<local-home>com.gcs.rmw.server.ServerBeanLocalHome</local-home>
com.gcs.rmw.server.ServerBeanLocal
<ejb-class>com.gcs.rmw.server.ServerBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
True
<cluster-config>
<partition-name>MyPartition</partition-name>
<home-load-balance-policy>
org.jboss.ha.framework.interfaces.FirstAvailable
</home-load-balance-policy>
<bean-load-balance-policy>
org.jboss.ha.framework.interfaces.FirstAvailable
</bean-load-balance-policy>
</cluster-config>
</enterprise-beans>
<ejb-client-jar>ServerClient</ejb-client-jar>
</ejb-jar>
i wrote some code to test this fearture.
System.out.println("loop ....");
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "jboss.naming:org.jnp.interfaces");
props.setProperty("jnp.partitionName", SysUtil.getPartitionName());
props.setProperty("java.naming.provider.url", "localhost:1100,duytest:1100");
props.setProperty("jnp.discoveryTimeout", "10000");
InitialContext ctx = new InitialContext(props);
Object renoteObj = ctx.lookup("ServerBean");
ServerHome home = (ServerHome)renoteObj;
server = home.create();
while(true){
try{
server.userLogin("admin", "admin");
System.out.println(renoteObj.toString());
System.gc();
}catch(Exception e){
//continue run
System.out.println(e.getMessage());
}
}
when in while loop only jboss 1 recieve call , and jboss 2 do not recieve call. I try again with another load balance policy but nothing change. When i turn off jboss 1, i recieve error tell that "Service unavalable"