Quantcast
Channel: Ignite Realtime : Unanswered Discussions - Support
Viewing all articles
Browse latest Browse all 4979

Smack 4.1.1 NullPointerException After Login

$
0
0

I've already setup a XMPP server (ejabberd) and able to connect to it.

 

I'm doing testing on Eclipse IDE 1st before starting development on Android platforms.

 

But every time I try to do a login, the system will prompt the following error:

connected

Exception in thread "main" java.lang.NullPointerException

  at org.jivesoftware.smack.util.stringencoder.Base64.encode(Base64.java:64)

  at org.jivesoftware.smack.util.stringencoder.Base64.encode(Base64.java:60)

  at org.jivesoftware.smack.util.stringencoder.Base64.encodeToString(Base64.java:42)

  at org.jivesoftware.smack.sasl.SASLMechanism.authenticate(SASLMechanism.java:199)

  at org.jivesoftware.smack.sasl.SASLMechanism.authenticate(SASLMechanism.java:169)

  at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 236)

  at org.jivesoftware.smack.tcp.XMPPTCPConnection.loginNonAnonymously(XMPPTCPConnect ion.java:365)

  at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java :452)

  at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java :410)

  at Test.main(Test.java:29)

 

 

Here's a preview of my codes:

XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration

  .builder().setUsernameAndPassword("admin", "password")

  .setServiceName("localhost").setHost("192.168.1.21")

  .setPort(5222).setSecurityMode(SecurityMode.disabled)

  .allowEmptyOrNullUsernames().build();

 

 

  XMPPTCPConnection connection = new XMPPTCPConnection(config);

 

 

  connection.connect();

 

 

  if (connection.isConnected()) {

  System.out.println("connected");

  }

 

 

  connection.login();

 

 

I did read up a bit on SASL and stuffs, but still unsure on how I can get around this.

 

 

P.S. I noticed that the documentation here https://www.igniterealtime.org/builds/smack/docs/latest/documentation/ seems to be outdated? By any chance it will be updated soon?


Viewing all articles
Browse latest Browse all 4979

Trending Articles