powered by Jive Software

Example dont work

I use code from this manual

http://www.igniterealtime.org/builds/smack/docs/latest/documentation/overview.ht ml

and include needed try:

import org.jivesoftware.smack.*;
import org.jivesoftware.smack.packet.Message; class Main { public static void main(String [] args) { System.out.println("start"); ConnectionConfiguration config = new ConnectionConfiguration("sibnsk.net", 5222); XMPPConnection con = new XMPPConnection(config); try { con.connect(); } catch(XMPPException e) { System.out.println("error connection"); System.exit(1); } System.out.println("connection ok"); try { con.login("tux", "123456", "bot"); } catch(XMPPException e) { System.out.println("error login "+e.getMessage()); System.exit(1); } System.out.println("login ok"); try { Chat chat = con.getChatManager().createChat("elcotel@conference.jabber.ru", new MessageListener() { public void processMessage(Chat chat, Message message) { System.out.println("Received message: " + message); } }); chat.sendMessage("I am bot!"); } catch(XMPPException e) { System.out.println("error chat"); System.exit(1); } }
}

and get error message:

./run

start

connection ok

java.lang.NullPointerException

at org.jivesoftware.smack.util.Base64.encodeBytes(Base64.java:636)

at org.jivesoftware.smack.sasl.SASLMechanism.challengeReceived(SASLMechanism.java: 152)

at org.jivesoftware.smack.SASLAuthentication.challengeReceived(SASLAuthentication. java:492)

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:338)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)

if I disable sasl (config.setSASLAuthenticationEnabled(false);), I get message:

./run

start

connection ok

error login service-unavailable(503)

where my error?

This should be caused by SMACK-264 and should be fixed in the next release. You could try

SASLAuthentication.unregisterSASLMechanism("DIGEST-MD5");

before you try to login or use the SVN version.

thanks, its work