powered by Jive Software

Exception in thread "main" java.lang.NullPointerException


#1

Smack version: 4.2.0
Full Error Stacktrace:

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.smackx.caps.EntityCapsManager.generateVerificationString(EntityCapsManager.java:725)
	at org.jivesoftware.smackx.caps.EntityCapsManager.generateVerificationString(EntityCapsManager.java:591)
	at org.jivesoftware.smackx.caps.EntityCapsManager.updateLocalEntityCaps(EntityCapsManager.java:487)
	at org.jivesoftware.smackx.caps.EntityCapsManager.<init>(EntityCapsManager.java:315)
	at org.jivesoftware.smackx.caps.EntityCapsManager.getInstanceFor(EntityCapsManager.java:378)
	at org.jivesoftware.smackx.caps.EntityCapsManager$1.connectionCreated(EntityCapsManager.java:121)
	at org.jivesoftware.smack.AbstractXMPPConnection.<init>(AbstractXMPPConnection.java:307)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection.<init>(XMPPTCPConnection.java:308)
	at com.tk.instantmessaging.Run.main(Run.java:39)

Run.java

XMPPTCPConnectionConfiguration.Builder builder = XMPPTCPConnectionConfiguration.builder();
builder.setUsernameAndPassword(username, password);
builder.setXmppDomain(DOMAIN);
builder.setHost("192.168.0.26");
builder.setPort(5222);
builder.setDebuggerEnabled(true);
builder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
builder.setResource("Rooster");

XMPPTCPConnectionConfiguration config = builder.build();

XMPPTCPConnection connection = new XMPPTCPConnection(config); // throws exception
connection.connect();
connection.login();

#2

Did you follow the instructions of Smack’s Readme?


#3

You are probably missing smack-java7/smack-android.