AnsweredAssumed Answered

Smack 4.1.8 Java error

Question asked by Param Y on Oct 6, 2016
Latest reply on Oct 6, 2016 by Param Y

Hello,

I am trying to connect to an XMPP server and i am receiving the following exception on the connect() method. Can you please let me know what could be wrong.

Java - 1.8
Smack 4.1.8

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.smackx.caps.EntityCapsManager.generateVerificationString(Entit yCapsManager.java:707)

  at org.jivesoftware.smackx.caps.EntityCapsManager.generateVerificationString(Entit yCapsManager.java:581)

  at org.jivesoftware.smackx.caps.EntityCapsManager.updateLocalEntityCaps(EntityCaps Manager.java:477)

  at org.jivesoftware.smackx.caps.EntityCapsManager.<init>(EntityCapsManager.java:30 9)

  at org.jivesoftware.smackx.caps.EntityCapsManager.getInstanceFor(EntityCapsManager .java:374)

  at org.jivesoftware.smackx.caps.EntityCapsManager$1.connectionCreated(EntityCapsMa nager.java:115)

  at org.jivesoftware.smack.tcp.XMPPTCPConnection.initConnection(XMPPTCPConnection.j ava:653)

  at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection. java:855)

  at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.ja va:364)

 

Code:

XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();

configBuilder.setHost("10.X.X.X");

configBuilder.setPort(5222);

configBuilder.setUsernameAndPassword("username","password:);

configBuilder.setServiceName("myservicename");

configBuilder.setSecurityMode(SecurityMode.disabled);

 

AbstractXMPPConnection  connection = new XMPPTCPConnection(configBuilder.build());

connection.connect();

// Log into the server

connection.login("username","password");

Outcomes