powered by Jive Software

Smack 4.1 alpha login failed SASL Authentication failed

I’m using smack api 4.1 alpha I can connect to my server but login failed ( connection.login(username,password) )

org.jivesoftware.smack.SmackException: SASL Authentication failed. No known authentication mechanisims.

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

at org.jivesoftware.smack.tcp.XMPPTCPConnection.login(XMPPTCPConnection.java:374)

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

at test.Testclass.initt(Testclass.java:72)

at test.Testclass.main(Testclass.java:84)

my problem there selectedMechanism is equal to null I need to set mechanism to it

public void authenticate(String username, String password, String resource)
throws XMPPErrorException, SASLErrorException, IOException,
SmackException {
SASLMechanism selectedMechanism = selectMechanism();
if (selectedMechanism != null) {
currentMechanism = selectedMechanism;

synchronized (this) {
currentMechanism.authenticate(username, connection.getHost(),
connection.getServiceName(), password);
try {
// Wait until SASL negotiation finishes
catch (InterruptedException e) {
// Ignore


if (!authenticationSuccessful) {
throw new NoResponseException();
else {
throw new SmackException(
“SASL Authentication failed. No known authentication mechanisims.”);