Exception while calling createNode

Hi,

I am using Smack 4.1.4 & followed this & this link to write a very

simple publisher class which creates a Node but am getting an

exception as follows. On server side I am using Tigase7.0.1 with

pubsub enabled.

Exception in thread “main” java.lang.ClassCastException: org.jivesoftware.smack.packet.UnparsedIQ cannot be cast to org.jivesoftware.smackx.pubsub.packet.PubSub

at org.jivesoftware.smackx.pubsub.PubSubManager.sendPubsubPacket(PubSubManager.jav a:322)

at org.jivesoftware.smackx.pubsub.PubSubManager.createNode(PubSubManager.java:146)

at Publisher.createAndConfigureNode(Publisher.java:59)

at Publisher.main(Publisher.java:31)

Following are the sent & received raw packets. It seems that server created the node successfully but

possibly I am doing something wrong in my code before the call to createNode().

Sent:

<stream:stream xmlns=‘jabber:client’ to=‘dev2’ xmlns:stream=‘http://etherx.jabber.org/streams’ version=‘1.0’ xml:lang=‘en’>

ADcwMDc4NDMzOABvbmNvLmFua2l0

<stream:stream xmlns=‘jabber:client’ to=‘dev2’ xmlns:stream=‘http://etherx.jabber.org/streams’ version=‘1.0’ id=‘b885af55-19e2-466b-92b1-b24ad182e676’ xml:lang=‘en’>

Smack

open111open

Received:

<?xml version='1.0'?>

stream:featuresPLAINANONYMOUS</stream:features>

<?xml version='1.0'?>

stream:features</stream:features>

700784338@dev2/Smack

Created in 92 ms

Here is my code which configures & creates the node,

private static Node createAndConfigureNode(XMPPTCPConnection con){

Node leaf=null;

// Create a pubsub manager using an existing XMPPConnection

PubSubManager mgr = new PubSubManager(con, “pubsub.dev2.xyz.com”);

// Create the node

ConfigureForm form = new ConfigureForm(DataForm.Type.submit);

form.setAccessModel(AccessModel.open);

form.setDeliverPayloads(true);

form.setNotifyRetract(true);

form.setPersistentItems(false);

form.setPublishModel(PublishModel.open);

try {

leaf = mgr.createNode(“testNode2”, form);

} catch (NoResponseException | XMPPErrorException

| NotConnectedException e) {

e.printStackTrace();

}

return leaf;

}

Can someone please take a look & let me know what am I doing wrong.

let me know what am I doing wrong.
Nothing. The PubSub component is sending an invalid stanza:

Created in 92 ms

The ‘text’ element is not qualified by an namespace, nor is it defined in “jabber:client” (and also not defined in XEP-60). RFC 6120 is pretty clear that IQ extension elements need to have a namespace.

RFC 6120 § 8.2.3

“The data content of the request and response is defined by the schema or other structural definition associated with the XML namespace that qualifies the direct child element of the IQ element”

Thanks.

Can you please let me know if it is possible to have it handled at client side & if so, what changes should I do in my code. If not, what will a valid stanza look like.

Hi Aejaz,

Did you then find a solution for the problem ? I am facing the same problem with Tigase…

Let me know if you have any progress, thanks !

Hey guys,

This issue with not XML valid stanza as a result of PubSub node creation was a internal bug of Tigase XMPP server.
I’ve reported that and now it has been fixed.

If you have such problem, please, update PubSub component version of your XMPP server to the latest.

Revision 389e94ba - Bug #4775 - removed element from PubSub node creation response as it’… - Tigase PubSub - T…

Sincerely yours,

nagibator2005