powered by Jive Software

java.lang.NullPointerException when trying to connect

I’m trying to get basic app to work and am having problems.

import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;

public class Test {

public static void main(String[] args) throws Exception {

    ConnectionConfiguration config = new ConnectionConfiguration("server", 5222);
    XMPPConnection con = new XMPPConnection(config);
                       
    try {
        con.connect();
        con.login("username","pass");
    } catch (XMPPException e) {
        System.out.println("Error while attempts to connect with server");
    }
}

}

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)