To enable JGroups on ubuntu system


While you are using jgroups on ubuntu you might get this exception

INFO: JGroups version: 2.6.16.GA
org.jgroups.ChannelException: failed to start protocol stack
	at org.jgroups.JChannel.startStack(JChannel.java:1617)
	at org.jgroups.JChannel.connect(JChannel.java:366)
	at org.jgroups.demos.Draw.go(Draw.java:174)
	at org.jgroups.demos.Draw.main(Draw.java:144)
Caused by: java.lang.Exception: problem creating sockets (bind_addr=shekhar/127.0.1.1, mcast_addr=228.10.10.10:45588)
	at org.jgroups.protocols.UDP.start(UDP.java:389)
	at org.jgroups.stack.Configurator.startProtocolStack(Configurator.java:129)
	at org.jgroups.stack.ProtocolStack.startStack(ProtocolStack.java:402)
	at org.jgroups.JChannel.startStack(JChannel.java:1614)
	... 3 more
Caused by: java.net.SocketException: bad argument for IP_MULTICAST_IF: address not bound to any interface
	at java.net.PlainDatagramSocketImpl.socketSetOption(Native Method)
	at java.net.PlainDatagramSocketImpl.setOption(PlainDatagramSocketImpl.java:309)
	at java.net.MulticastSocket.setInterface(MulticastSocket.java:424)
	at org.jgroups.protocols.UDP.createSockets(UDP.java:527)
	at org.jgroups.protocols.UDP.start(UDP.java:385)

To solve this you need to disable ipv6 on ubuntu. To do that do the following

java -Djava.net.preferIPv4Stack=true -classpath /home/shekhar/JB431/opt/jboss-soa-p-5/jboss-as/lib/concurrent.jar:/home/shekhar/JB431/opt/jboss-soa-p-5/jboss-as/common/lib/commons-logging.jar:/home/shekhar/JB431/opt/jboss-soa-p-5/jboss-as/server/all/lib/jgroups.jar org.jgroups.demos.Draw

Discover more from Shekhar Gulati

Subscribe to get the latest posts sent to your email.

One thought on “To enable JGroups on ubuntu system”

  1. Nice one, this one creeped on me out of no where (wonder why it started all of a sudden) and you had it spot on.

    @newbies
    Only thing needed is really the preferIPv4Stack property

    -Djava.net.preferIPv4Stack=true instead of all the arguments (i.e classpath)

Leave a reply to Mahlatse Cancel reply