Failover - must be missing something
emsien Sep 16, 2003 2:20 PMHi
Ok I guess I am missing something when it comes to clustering. I'm attempting to do a proof of concept test with clustering JBoss and have not been able to successfully get this to work, currently only attempting to get failover working.
First of all I am running 3.2.2RC2 and have 2 machines setup and running, a Windows 2000 Advanced server and a Windows NT workstation. A small test environment. I have started JBoss on both machines and clustering appears to be up and running.
I judge this by the messages output by JBoss on machine 1 when the second machine comes up:
12:44:20,496 INFO [DefaultPartition] New cluster view (id: 13, delta: 1) : [192.168.254.118:1099, 192.168.254.128:1099]
12:44:20,506 INFO [DefaultPartition:ReplicantManager] Dead members: 0
I build and deploy my Stateless Session bean on both machines.
The jboss.xml file is:
<?xml version="1.0" encoding="UTF-8"?>
<enterprise-beans>
<ejb-name>Interest</ejb-name>
<jndi-name>interest/Interest</jndi-name>
True
</enterprise-beans>
I have a simple stand alone app that I run to call the EJB. The jndi properties file for the app is:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=jnp://192.168.254.128:1100,jnp://192.168.254.118:1100
jnp.partitionName=DefaultPartition
I start the app and call the ejb and I get this message in the jboss console of the first machine:
12:47:55,555 INFO [STDOUT] Someone called `calculateCompoundInterest!'
Indicating that the EJB call worked. I then shutdown that version of jboss and the second machine's
console displays this message:
12:52:27,231 INFO [DefaultPartition] New cluster view (id: 14, delta: -1) : [192.168.254.128:1099]
12:52:27,251 INFO [DefaultPartition:ReplicantManager] Dead members: 1
Once again indicating to me that the clustering is working.
I then have the application call the EJB again.
And I get this message:
java.rmi.ConnectException: Connection refused to host: 192.168.254.118; nested exception is:
java.net.ConnectException: Connection refused: connect
My assumption was that the call would failover to the second jboss server, but obivously doesn't. If I stop the client app and
start it back up the client app connects and makes the call to the EJB successfully.
Ok I must not be understanding something. Can somebody explain what I am doing wrong here. I've read the jboss
clustering doc and have spent a lot of time going through the forums but don't seem to get what I am doing wrong.
My understanding was that if I set the custered tag to true in jboss.xml and point to HAJNDI port that the failover
happens automatically and that no special code is needed.
Thanks for any help
Merv