AnsweredAssumed Answered

Question of Smack4.2

Question asked by rock on May 11, 2017
Latest reply on Jul 10, 2017 by wbb

i am new to smack4.2, i want to write a demo of smack4.2 to connect my own server, but it shows me the errors, can anyone can help me?

code:

XMPPTCPConnectionConfiguration.Builder  config = XMPPTCPConnectionConfiguration.builder();

  config.setHost("127.0.0.1");

  config.setPort(5222);

  DomainBareJid serviceName = JidCreate.domainBareFrom("test1@127.0.0.1") ;

  config.setServiceName(serviceName);

  config.setHostAddress(InetAddress.getByName("127.0.0.1"));

  config.setUsernameAndPassword("test1", "test1");

  config.setSecurityMode(XMPPTCPConnectionConfiguration.SecurityMode.disabled);

  XMPPTCPConnection xmppCon = new XMPPTCPConnection(config.build());

  xmppCon.connect();

  xmppCon.login();

 

error msg:

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(Entit yCapsManager.java:723)

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

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

  at org.jivesoftware.smackx.caps.EntityCapsManager.<init>(EntityCapsManager.java:31 3)

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

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

  at org.jivesoftware.smack.AbstractXMPPConnection.<init>(AbstractXMPPConnection.jav a:304)

  at org.jivesoftware.smack.tcp.XMPPTCPConnection.<init>(XMPPTCPConnection.java:306)

Outcomes