1

I am implementing a chat application for which I have an Openfire Support as the backend and using Asmack version 8-0.8.9 to implement it. However I am facing an issue of Non SASL Authentication during login and I get "No Response from Server" in the message. In addition, I am also facing an issue that whenever the app is in idle state for few minutes (without performing anything) my session gets removed from the openfire and I get disconnected.

This is how I am connecting to openfire and then performing login:

AndroidConnectionConfiguration  connConfig = 
new AndroidConnectionConfiguration(HOST, PORT,SERVICE);
connConfig.setDebuggerEnabled(true);
connConfig.setReconnectionAllowed(false);
connConfig.setRosterLoadedAtLogin(true);
connConfig.setSASLAuthenticationEnabled(false);
connection.connect();
connection.login(Uname,Password);

In most of the cases this is working fine but randomly it gives me an error during login i.e. No Response from server with Non-SASL Authentication message.

What am I doing wrong? Let me know if you require any other detail for the same.

Thanks in advance!

Tushar Gogna
  • 4,963
  • 6
  • 31
  • 42

1 Answers1

0

You have to make sure that you included all necessary jar's.

Depending on you dependency management system, you have to add it differently, but make sure to include smack-sasl-javax, smack-java7 and smack-resolver-javax.

With maven it would be:

<dependency>
    <groupId>org.igniterealtime.smack</groupId>
    <artifactId>smack-sasl-javax</artifactId>
    <version>4.1.6</version>
</dependency>
<dependency>
    <groupId>org.igniterealtime.smack</groupId>
    <artifactId>smack-java7</artifactId>
    <version>4.1.6</version>
</dependency>
<dependency>
    <groupId>org.igniterealtime.smack</groupId>
    <artifactId>smack-resolver-javax</artifactId>
    <version>4.1.6</version>
</dependency>

And make sure that you are verifying the server certificate.

This can be done with 'setHostnameVerifier(XMPPHostnameVerifier verifier)' and 'setCustomSSLContext(SSLContext context)'.