Problem with simple clustering example
marcusdidiusfalco Feb 9, 2008 10:44 AMHallo, I try to follow a very simple example for clustering (from Jamae, Johnson: JBoss in Action)
JBoss 4.2.0.GA
On a Windows XP machine I have started two instances, node1 and node2 which are copies of the all configuration out of the box. On node2 I use the BindingManager. Both instances start up normally and you can tell from the output that there are two nodes in the DefaultPartion.
I have deployed a very simple SLSB to both nodes.
import javax.ejb.Remote;
@Remote
public interface Counter {
public void printNumber(int number);
}
@Stateless
public class CounterBean implements Counter {
public void printNumber(int number) {
System.out.println(number);
}
}
<jboss>
<enterprise-beans>
<session>
<ejb-name>CounterBean</ejb-name>
<jndi-name>CounterBean</jndi-name>
<clustered>True</clustered>
</session>
</enterprise-beans>
</jboss>
The deployment succeeds.
The client:
public class Testclient {
public static void main(String[] args) {
try {
Context initialContext = new InitialContext();
Counter counter = (Counter) initialContext.lookup("CounterBean/remote");
for (int i=0; i<1000; i++) {
counter.printNumber(i);
Thread.sleep(500);
}
} catch (NamingException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}jndi.properties:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
When I run the client a get a
javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1317) at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1446) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:594) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587) at javax.naming.InitialContext.lookup(InitialContext.java:351) at clustering.Testclient.main(Testclient.java:10) Caused by: java.net.SocketTimeoutException: Receive timed out at java.net.PlainDatagramSocketImpl.receive0(Native Method) at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136) at java.net.DatagramSocket.receive(DatagramSocket.java:712) at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1287)
I have already tried to disable my firewall and set loopback="true" in <udp .. in cluster-service.xml.
Many thanks for any advise