powered by Jive Software

BOSH con.login() giving null pointer exception with ejabberd

Hi,

I am using smack 4.20 with ejabberd 17.04.

Ejabberd http-bind is enabled and works fine with converse.js.

When i try to do a login using smack, its giving null pointer exception. The below is the stack trace for the same:

Jun 02, 2017 9:40:24 PM org.igniterealtime.jbosh.BOSHClient init

INFO: Starting with 1 request processors

21:40:25 RECV (0):

Jun 02, 2017 9:40:25 PM org.jivesoftware.smack.SASLAuthentication selectMechanism

WARNING: Server did not report any SASL mechanisms

Exception in thread “main” java.lang.NullPointerException

at java.util.Collections$UnmodifiableCollection.(Collections.java:1051)

at java.util.Collections$UnmodifiableSet.(Collections.java:1122)

at java.util.Collections.unmodifiableSet(Collections.java:1112)

at org.jivesoftware.smack.ConnectionConfiguration.getEnabledSaslMechanisms(Connect ionConfiguration.java:476)

at org.jivesoftware.smack.SASLAuthentication.selectMechanism(SASLAuthentication.ja va:359)

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

at org.jivesoftware.smack.bosh.XMPPBOSHConnection.loginInternal(XMPPBOSHConnection .java:223)

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

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

at com.huawei.universalcrm.server.service.JabberSmackAPI.main(JabberSmackAPI.java: 128)

21:40:25 RECV (0): stream:featuresPLAINDIGEST-MD5X-OAUTH2SCRAM-SHA-1</me chanism>ANONYMOUS</stream:features>

Jun 02, 2017 9:40:55 PM org.jivesoftware.smack.AbstractXMPPConnection callConnectionClosedOnErrorListener

WARNING: Connection XMPPBOSHConnection[not-authenticated] (0) closed with error

java.lang.NullPointerException

at org.jivesoftware.smack.packet.XMPPError$Type.fromString(XMPPError.java:369)

at org.jivesoftware.smack.util.PacketParserUtils.parseError(PacketParserUtils.java :857)

at org.jivesoftware.smack.bosh.XMPPBOSHConnection$BOSHPacketReader.responseReceive d(XMPPBOSHConnection.java:537)

at org.igniterealtime.jbosh.BOSHClient.fireResponseReceived(BOSHClient.java:1601)

at org.igniterealtime.jbosh.BOSHClient.processExchange(BOSHClient.java:1136)

at org.igniterealtime.jbosh.BOSHClient.processMessages(BOSHClient.java:990)

at org.igniterealtime.jbosh.BOSHClient.access$300(BOSHClient.java:100)

at org.igniterealtime.jbosh.BOSHClient$RequestProcessor.run(BOSHClient.java:1719)

at java.lang.Thread.run(Thread.java:745)

Jun 02, 2017 9:40:55 PM org.jivesoftware.smack.AbstractXMPPConnection callConnectionClosedOnErrorListener

WARNING: Connection XMPPBOSHConnection[not-authenticated] (0) closed with error

org.igniterealtime.jbosh.BOSHException: Terminal binding condition encountered: remote-stream-error (Encapsulated transport protocol error.)

at org.igniterealtime.jbosh.BOSHClient.checkForTerminalBindingConditions(BOSHClien t.java:1385)

at org.igniterealtime.jbosh.BOSHClient.processExchange(BOSHClient.java:1161)

at org.igniterealtime.jbosh.BOSHClient.processMessages(BOSHClient.java:990)

at org.igniterealtime.jbosh.BOSHClient.access$300(BOSHClient.java:100)

at org.igniterealtime.jbosh.BOSHClient$RequestProcessor.run(BOSHClient.java:1719)

at java.lang.Thread.run(Thread.java:745)

The following is the code which i am using while trying to login:

BOSHConfiguration config = BOSHConfiguration.builder().setHost(“10.18.246.229”).setXmppDomain(“huaweicrm”)

.setPort(Integer.parseInt(“5280”)).setFile("/http-bind/").setSecurityMode(Connec tionConfiguration.SecurityMode.disabled)

.setDebuggerEnabled(true).build();

AbstractXMPPConnection con = new XMPPBOSHConnection(config);

con.connect();

con.login(“admin”, “admin”);

Let me know what am i doing wrong.

Thanks!