Quantcast
Channel: Ignite Realtime : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 10742

Problems in using Smack.

$
0
0

Hi,guys.

I am a newer in openfire and smack.

I just code a simply program to test my openfire server.

but there are some errors.

And I find that the Smack-docs is not the latest one ,the examples in Smack-doc not suit the Smack 4.0.

Where can i find the latest docs ?

I am newer here ,any sugestions can help ,thank u !

 

my code:

import java.io.IOException;
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.packet.*;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;

public class IMClient{
public static void main(String[] args) throws SmackException, IOException, XMPPException{
   XMPPConnection con = new XMPPTCPConnection("10.199.36.124");
   con.connect();
   con.login("zhuoge", "login137235");
   ChatManager chatmanager = ChatManager.getInstanceFor(con);
   Chat newChat = chatmanager.createChat("wxf@10.199.36.124", new MessageListener() {
       public void processMessage(Chat chat, Message message) {
           System.out.println("Received message: " + message);
       }
   });
   newChat.sendMessage("Howdy!");

}
}

 

errors:

Exception in thread "main" java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserFactory

at org.jivesoftware.smack.SmackConfiguration.processConfigFile(SmackConfiguration. java:321)

at org.jivesoftware.smack.SmackConfiguration.processConfigFile(SmackConfiguration. java:316)

at org.jivesoftware.smack.SmackConfiguration.<clinit>(SmackConfiguration.java:148)

at org.jivesoftware.smack.XMPPConnection.<clinit>(XMPPConnection.java:113)

at IMClient.main(IMClient.java:9)

Caused by: java.lang.ClassNotFoundException: org.xmlpull.v1.XmlPullParserFactory

at java.net.URLClassLoader$1.run(Unknown Source)

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)

... 5 more


Viewing all articles
Browse latest Browse all 10742

Trending Articles