Skip to main content

JGroups demos on SuSE Linux 10.0

Posted by dcengija on April 3, 2006 at 3:42 PM PDT

JGroups is a toolkit for reliable multicast communication in Java. If you're like me, which means that you barely know what multicast means, and you're running SuSE 10.0, you'll have troubles to understand why JGroups demos don't work and what you need to do to have it working.

First of all, lets see what multicast is: it's a way to send a message over network to selected recipients which belong to the same, appropriate multicast group. If you need more details on multicast, and network protocols in general, you might find interesting a book by W. Richard Stevens, TCP/IP Illustrated, which is even available online for free. (I have to say 'thank you for pointing me to it' to a very good friend of mine -- šta ima, Muratići? :-)

Why would we need JGroups? There are many uses, among them the most interesting are implementation of clustering features for applications and application servers, distributed cache, http session replication etc. See Success stories on JGroups website for more ideas.

Now we can start with JGroups evaluation. Download it from Sourceforge.net, unpack and open INSTALL.html. Scroll down and look for an explanation on how to run a demo program. Setup your classpath -- you could use this simple shell trick:

davor@linux:~/memtmp/JGroups-2.2.9.1.bin> C=.; for i in *.jar; do C=$C:$i; done
davor@linux:~/memtmp/JGroups-2.2.9.1.bin> echo $C
.:commons-logging.jar:concurrent.jar:jgroups-all.jar:jmxri.jar:log4j-1.2.6.jar

Now you're ready to run a demo program:

davor@linux:~/memtmp/JGroups-2.2.9.1.bin> java -cp $C org.jgroups.demos.Draw
-- snip log4j warnings --
org.jgroups.ChannelException: failed to start protocol stack
        at org.jgroups.JChannel.connect(JChannel.java:393)
        at org.jgroups.demos.Draw.go(Draw.java:172)
        at org.jgroups.demos.Draw.main(Draw.java:141)
Caused by: java.lang.Exception: exception caused by UDP.start(): java.net.BindException: Cannot assign requested address
        at org.jgroups.stack.Protocol.handleSpecialDownEvent(Protocol.java:600)
        at org.jgroups.stack.DownHandler.run(Protocol.java:117)
davor@linux:~/memtmp/JGroups-2.2.9.1.bin> 

Unfortunatelly, on SuSE 10.0 default installation, demo fails with the message shown above. What you need is VM option -Djava.net.preferIPv4Stack=true in order to start demo:

davor@linux:~/memtmp/JGroups-2.2.9.1.bin> java -Djava.net.preferIPv4Stack=true -cp $C org.jgroups.demos.Draw

-------------------------------------------------------
GMS: address is 192.168.2.101:1076
-------------------------------------------------------
** View=[192.168.2.101:1076|0] [192.168.2.101:1076]

Start demo at lease twice and try to draw something on one window.

snapshot11.jpg

Unfortunatelly, on SuSE10 with firewall enabled, demo fails: firewall is blocking multicast. I admit that I don't understand much about firewalls, so I simply disable it for the purpose of this evaluation.

snapshot8.jpg

Now the demo finally works:

snapshot12.jpg

If you do understand firewalls and know how to configure them without disabling, please post a comment. Thanks.

Related Topics >>