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