powered by Jive Software

Smack 4.1.8 Java error

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.(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”);

I found the solution. A few missing dependencies of jar was needed.

minidns-0.1.3.jar

jxmpp-util-cache-0.5.0-alpha2