Problem processing received packets

Hi,

I’m trying to develope a PubSub (XEP-0060) client using Smack 3.1.0 and SU-Smack 1.3. I have some problems with the reception of packets, sometimes i the client receives and processes correctly the packet, but sometimes the i get the next error:

Send : <iq id="hwxAS-4" to="pubsub.server" type="get"><pubsub xmlns="http://jabber.org/protocol/pubsub"><create node="testnode3"/></pubsub></iq> Exception in thread "Smack Packet Reader (0)" java.lang.NoClassDefFoundError: org/apache/commons/lang/WordUtils
     at se.su.it.smack.packet.XMPPElementFactory.create(XMPPElementFactory.java:20)
     at se.su.it.smack.packet.XMPPElementFactory.create(XMPPElementFactory.java:32)
     at se.su.it.smack.provider.ProviderSupport.parseElement(ProviderSupport.java:54)
     at se.su.it.smack.provider.PubSubProvider.parseIQ(PubSubProvider.java:25)
     at org.jivesoftware.smack.PacketReader.parseIQ(PacketReader.java:597)
     at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:275)
     at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
     at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.WordUtils
     at java.net.URLClassLoader$1.run(Unknown Source)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader.findClass(Unknown Source)
     at java.lang.ClassLoader.loadClass(Unknown Source)
     at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
     at java.lang.ClassLoader.loadClass(Unknown Source)
     at java.lang.ClassLoader.loadClassInternal(Unknown Source)
     ... 8 more

The server answers correctly always (i scan the packets with Wireshark), but my client only processes them correctly sometimes. Here an example the code of the client:

import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Packet; import se.su.it.smack.pubsub.PubSub;
import se.su.it.smack.pubsub.elements.CreateElement; public class TestCreateNode {
        public static void main(String[] args) throws Exception {         XMPPConnection con;
        ConnectionConfiguration config = new ConnectionConfiguration("server",5222);
        con = new XMPPConnection(config);
                                    try {
               con.connect();
          } catch (XMPPException e) {
               System.out.println("Error while attempts to connect with server");
        }
        con.login("test2","1234");
                 con.addPacketListener(new PacketListener(){             public void processPacket(Packet packet) {
                 System.out.println("Recv : "+packet.toXML());
                             }
                    },null);
                        PubSub pubsub = new PubSub();            pubsub.setTo("pubsub.server");
                CreateElement ce = new CreateElement("testnode");
        pubsub.addChild(ce);
                con.sendPacket(pubsub);
        System.out.println("Send : " + pubsub.toXML());
        Thread.sleep(5000);            }
}

Anyone knows whats the problem?

Thanks

Berto

Berto,

This might be a shortcoming of su-smack. Your problem looks similar to this and this forum entry.

Did you check on http://github.com/crispywalrus for the latest updates?

Michael

Thanks for your answer, i have many problems with that su-smack, but i could solve tht one, i needed a library called commons-lang-2.4.jar, downloaded it from http://commons.apache.org/lang/ and it worked.

Also thanks for the link to the updated library, now i’m using a really complete one that i found here: https://code.zauber.com.ar/repos/3rdparty/, i’ll compare both to see which one is better, but that one i’m using works really good.

Berto

I’m developing the branch of su-smack adding support for the missing pub-sub features (https://code.zauber.com.ar/repos/3rdparty/su-smack/branches/24/ ) . When the project that triggers this changes reaches the first release i was planning to send all the patches back and write about it.

Fell free to contact me.