JGroups 3 won't work with 2 anyway, as they have different wire formats.
Post by Stefano LenziDear all,
I have mode some compatibility test between JGroups 3 and JGroups 2
ported on Android, and they DO NOT SEEM TO WORK... Please read all my
comments below...
I hope that you can give some tips on how to proceed...
Ciao,
Stefano
Post by Stefano LenziHi All,
quick reply: communication between JGroups Android and JGroups PC
WORKS.
Great :)
Yes it is good news
Post by Stefano LenziMy current configuration uses JGroups 2.12.0.Alpha3 on both
machine, it uses BPING as discovery/membership protocol with
ip_mcast=false as suggest in thread. Moreover, I used the same
udp.xml file that is the default define by Yann in its porting (
see
https://github.com/fallen/touchsurface-android-jgroups/blob/master/assets/udp.xml ),
and by using that JGroups configuration everything worked as
expected or almost...
In fact, all the time that i was invoking the constructor new
Message(Address,Address,Serializable) with object references that
was not typed as Serializable the Android classloader was thrwoing
an exception MethodNotFoundException for
Message(Address,Address,Object).
This kind of error happened to me a few times while "porting"
JGroups to Android 2.3.
When I had this error, it meant that the given class was not part of
Android SDK.
My guess is that the code path taken when sending a non-Serializable
object by JGroups makes use of a class which does not exist in
Android SDK.
You can have a little bit more details by looking at the stack trace
in Android "logcat" using "$ adb logcat" command when your device is
plugged via USB or connected via TCP/IP via the "$ adb connect <IP>"
command.
If you have troubles understanding the error maybe you can post it
to the list...
When the class is identified, you need to work around it by
implementing it or using another class...
Yann, thank you for the good hint, but I think I did not explain myself
very well..
In fact, *I could fix the issue*, the workaround was simply to use a new
variable aux of type Serializable and assign the content of the message
BROKEN CODE (when running on Android it throws MethodNotFoundException ,
but it is Java code that run perfectly on PC)
Address src, dst;
String content = "I'm a very simple Serializable content for JGroups";
Message jgroupsMessage = new Message(src,dst,content);
WORKAROUND CODE (it works both on Android and PC, it actually force Java
to cast the type Serializable)
Address src, dst;
String content = "I'm a very simple Serializable content for JGroups";
Serializable aux = (Serializable) content
Message jgroupsMessage = new Message(src,dst,aux);
Post by Stefano LenziIt is more complex to describe that to fix. For example the code
String content = "send me on Android";
Message msg = new Message(null, null, content)
results in a MethodNotFoundException, you have to rewrite the Java
String content = "send me on Android";
Serializable aux = (Serializable) content;
Message msg = new Message(null, null, aux)
and the communication will work as a charm
My next step, would also give a try to JGroups 3.3.1.FInal on PC
with JGroups 2.12.0.Alpha3 on Android
Bela is right, it might be a very good idea to use an up to date
version of JGroups and make small modifications to make it run on
Android.
FYI, my port on GitHub is very "experimental", it has been very
poorly tested (it worked on small examples like "Touchsurface" which
is a "port" of the Draw sample to Android) and I must say that I
speak very poorly Java, I am mostly an embedded software developer :)
This was part of a school project and is not for use in a production
environment at all.
FYI I used BPING because I couldn't get multicast to work with the
devices I had at the time of the port.
I don't know if the issue was with the device, or with my code, or
with Android 2.1/2.3 itself.
I don't know if it works better with Android 3 or 4, I never tested
multicast again after that on more modern Android devices.
I have bad news on this side... In fact JGroups 3.X with JGroups
2.12.0.Aplha3 on Android DOES NOT WORK (at least for me). I performed
several test with the following scenario: a PC running JGroups 3.3.1 and
an Android Tablet running Yana's port of JGroups 2.12.0.Alpha3. They
were both connected by means of wireless network, and no other IP
interfaces were connected to any other network (of course loopback
network was on). The same enviroment WORKS if I use JGroups
2.12.0.Alpha3 on both sides, so I believe that the problem relies in
compatibily issue among the JGroups 3.X and JGroups 2.X.
RESULT: FAILED
Some attribute defined in udp.xml used by JGroups2 does not exist
anymore in JGroups3 library, so the loading of the JChannel was failing.
BPING num_ping_requests, pbcast.NAKACK use_stats_for_retransmission, and
pbcast.NAKACK gc_lag
I deleted the attribute from udp.xml of JGroup2
Test B: Using JGroup2 udp.xml with delete attribute
RESULT: FAILED
2013-06-14 11:09:21,856 | ERROR | ReceiverThread | BPING
| 54 - org.jgroups - 3.3.1.Final | failed receiving packet
(from /192.168.1.101:8555 <http://192.168.1.101:8555>)
java.lang.NegativeArraySizeException
at
org.jgroups.stack.IpAddress.readFrom(IpAddress.java:214)[54:org.jgroups:3.3.1.Final]
at
org.jgroups.util.Util.readAddress(Util.java:890)[54:org.jgroups:3.3.1.Final]
at
org.jgroups.Message.readFrom(Message.java:784)[54:org.jgroups:3.3.1.Final]
at
org.jgroups.protocols.BPING.run(BPING.java:148)[54:org.jgroups:3.3.1.Final]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_27]
2013-06-14 11:08:44,593 | ERROR | ReceiverThread | BPING
| 54 - org.jgroups - 3.3.1.Final | failed receiving packet
(from /192.168.1.101:8559 <http://192.168.1.101:8559>)
java.lang.IllegalArgumentException: magic number 27689 is not available
in magic map
at
org.jgroups.Message.readHeader(Message.java:886)[54:org.jgroups:3.3.1.Final]
at
org.jgroups.Message.readFrom(Message.java:803)[54:org.jgroups:3.3.1.Final]
at
org.jgroups.protocols.BPING.run(BPING.java:148)[54:org.jgroups:3.3.1.Final]
2013-06-14 11:08:56,477 | ERROR | ReceiverThread | BPING
| 54 - org.jgroups - 3.3.1.Final | failed receiving packet
(from /192.168.1.101:8557 <http://192.168.1.101:8557>)
java.lang.ArrayIndexOutOfBoundsException: -14881
at
org.jgroups.conf.ClassConfigurator.get(ClassConfigurator.java:146)[54:org.jgroups:3.3.1.Final]
at
org.jgroups.Message.readHeader(Message.java:884)[54:org.jgroups:3.3.1.Final]
at
org.jgroups.Message.readFrom(Message.java:803)[54:org.jgroups:3.3.1.Final]
at
org.jgroups.protocols.BPING.run(BPING.java:148)[54:org.jgroups:3.3.1.Final]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_27]
The above issue let me think that the problem is that the BPING protocol
(i.e. the packet that are sent) have been changed from JGroups 2.X to
JGroups 3.X
Using a different discovery protocol PING
Test C: Using the PING protocol instead of BPING
RESULT: FAILED
No particular error shown, but the problem was that the view of the
cluster on the PC contained only the PC itself, but it was expected
because also Yann disabled PING due to multicast "issue" on Android
Using a different discovery protocol TCPPING
Test D: Using the TCPPING protocolo instead of BPING
RESULT: FAILED
It was clearly stated on the log that JGroups 3 was discarding packet
because they were built with a different version of the library, as you
2013-06-14 13:23:20,886 | WARN | :5000],null,null | TCP
| 52 - org.jgroups - 3.3.1.Final | [JGRP00006] failed
accepting connection from peer: %s
java.io.IOException: packet from /192.168.1.101:45258
<http://192.168.1.101:45258> has different version (2.12.0) from ours
(3.3.1); discarding it
at
org.jgroups.blocks.TCPConnectionMap$TCPConnection.readPeerAddress(TCPConnectionMap.java:501)[52:org.jgroups:3.3.1.Final]
at
org.jgroups.blocks.TCPConnectionMap$TCPConnection.<init>(TCPConnectionMap.java:376)[52:org.jgroups:3.3.1.Final]
at
org.jgroups.blocks.TCPConnectionMap$Acceptor.handleAccept(TCPConnectionMap.java:298)[52:org.jgroups:3.3.1.Final]
at
org.jgroups.blocks.TCPConnectionMap$Acceptor.run(TCPConnectionMap.java:282)[52:org.jgroups:3.3.1.Final]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_27]
No more viable solution on my side....
Cheers!
Post by Stefano LenziPlease my comment below
Ciao,
Stefano
Thank you for the quick reply!
I the mean while I started to experiment, and I found that
another guys
is having the same issue that I'm experiencing when trying to
communicate between PC <-> Android with JGroup [
http://jgroups.1086181.n5.nabble.com/jgroups-users-BPING-broadcast-ping-td9613.html
]. The default membership protocol used by JGroup standard
and JGroup
Android's port are different.
What do you mean ? The group membership protocol (GMS) has
nothing to do with this !
I recall Yann had issues with IP multicasting under Android
2.x or so, but IIRC, they disappared on Android 3.x. In other
words: you had to use BING until 3.x, where you could use
BPING or (standard) PING
I told you that I'm a newbie of JGroups and by looking at JGroups
log, I thought that PING, BPING, and so are the protocol used
internally by JGroups, more I thought that they were the protocol
for joining, renewing, and disconnecting from JGroups cluster, but
it seems I'm wrong :)
.
If you use a given discovery protocol, then of course you have
to use it both on your Android device and your PC. The
configuration neds to be the same.
In fact, as I said at the begining of the email by using the
https://github.com/fallen/touchsurface-android-jgroups/blob/master/assets/udp.xml for
loading the JGroup everything worked
I would give it a try to generate the android port for
JGroup 3.X,
starting from the code
https://github.com/fallen/touchsurface-android-jgroups
developed by Yann
Sionneau
I wouldn't start from that code, but rather start from the
current master (to be 3.4). Then take a look at what Yann did
for the 2.x port, as I think the procedure will be more or
less the same.
Thank you! I will keep in mind! I will let you know if I get any
progress on the porting
Note that 3.4 will be license under Apache License 2.0, this
may or may not make it easier for you. Probably doesn't have
an impact...
No problem, actually ASF2.0 is even better for my needs
Moreover I would try to use the advice give by Bela Ban
for changing the
membership protocol on the PC side from PING to BPING and
by disabling
multicast.
If you have Android 3.x phones, I'd actually suggest to try
PING first and see if it works. BPING uses broadcasting and
that's not very appreciated by network admins, especially in
wireless networks, as it generates a lot of network traffic.
BPING was working perfectly :)
@Alex: have you had any progress with your PC <-> Android
communication?
@Bela: can you tell us if JGroups support multiple cluster
membership
protocol at the same time?
On Tue, Jun 11, 2013 at 6:15 PM, Gonçalo Amador
As far as I'm aware no port for Android of JGroups 3.x
exists.
Two workarrounds assuming that there is no issue with
communication
- Create nodes that serve as socket Clusters to
JGroups channe,
i.e., UDP server connected to channel that relays from
and to Android.
- Recompile the source to Android and hope for the
best (possibly
some issues might happen by example swing not
supported), or correct
all issues.
Not sure regarding second question.
On Tue, Jun 11, 2013 at 1:54 PM, Stefano Lenzi
Dear all,
I'm a new user of JGroups and I have some very
1 - Does a port for Androdi of JGroups 3.X exist?
Or are you
planning to do that?
2 - Can I specify multiply discovery protocol for
a single
cluster? If yes is it also supported by JGroups 2.X ?
Best regards,
Stefano "Kismet" Lenzi
--
Bela Ban
Lead JGroups / Clustering Team
JBoss