Hi,
I’m new here, and I apologize if this gets asked a lot. I’m using Smack 3.2.0 on Android 2.3 and am trying to implement PubSub.
I can create connections, log in, create nodes, but cannot subscribe. I always get
java.lang.ClassCastException: org.jivesoftware.smack.util.PacketParserUtils$2 at org.jivesoftware.smackx.pubsub.Node.subscribe(Node.java:151)
String jid = “sean@my.openfire.local”;
LeafNode ln = null;
ln = (LeafNode) pubsubMgr.getNode(node); // gets a valid Node, this is fine
ln.subscribe(jid); // ClassCastException here
Node is created with the following config form
ConfigureForm f = new ConfigureForm(FormType.submit);
f.setPersistentItems(true);
f.setDeliverPayloads(true);
f.setAccessModel(AccessModel.open);
f.setPublishModel(PublishModel.open);
f.setSubscribe(true);
f.setNodeType(NodeType.leaf);
In a regular, non-Android app, my code works fine, but not on Android. One thing I am doing is specifying using bks keystore in ConnectionConfiguration, since Android does not support jks, but I have no idea why this ClassCastException occurs.
I was reading the source code of PacketParserUtils.java and it says somewhere in the comments of parseProperties method that
ClassCastExceptions will occur when both the sender and receiver of the packet don’t have identical versions of the same class. I am not sure how to trace where the problem is, though.
Anyone have any clue on how to resolve this? Any suggestions will be welcome, as I am more than willing to modify the code to get it to run properly on Android.
Thanks!