XMPPException repetition only after entering incorrect password


I have been working on a part of my code to notify the user when the password is incorrect by catching the exception thrown from connection.login(). It works however if I try to login again with the correct password then the exception is still thrown. The exception is "“SASL authentication failed using mechanism DIGEST-MD5”.

I am using the following code :

try {

Log.i(“service”,“Attempting to log in…”);

connection.login(global.$username, global.$password);


catch (XMPPException ex) {




I can log in with the correct username and password so I know everything works. It’s only after a failed attempt that the correct password will not work.

The message is sent to the log every time so connection.login() is definately being run.

I am using asmack. My question is do I have to reset something before attempting to log in again?

Any help would be greatly appreciated.



Same problem here…anyone knows how to solve this issue?

Offhand, this doesn’t seem like a Smack issue, but a server one. You should try running with debug enabled and see if you are getting back the failed attempt from the server in both cases. If you are, then your issue is with your server.

Thanks for you reply. I dont’ think this kind of problem depends on OpenFire. If I try to connect to XMPP server with another client (Adium) and I insert my password twice (wrong - correct), the authentication process works perfectly.