(a)Smack returns “service-unavailable (503)” error at login()

若如初见. 提交于 2019-12-05 10:08:40

Asmack is able to establish a new connection to the server, but it falls into Non-SASL mode for some reason ( The call of NonSASLAuthentication.authenticate(NonSASLAuthentication.java:77) ). I think that's what the server is trying to tell you with the "service-unavailable(503)" response, is that it does not support Non-SASL authentication.

Try to debug why smack does not try SASL authentication.

Note: The lines in the smack source viewer are a bit off because off different versions and the patches from asmack.

It's working finally for me by this way :

ConnectionConfiguration connConfig = new ConnectionConfiguration(host,port,host);
connection = new XMPPConnection(connConfig);
connConfig.setSASLAuthenticationEnabled(true); 
connection.connect();
connection.login(userID, password);

I have used Android using Asmack library which I have downloaded from below URL:

https://code.google.com/p/asmack/downloads/detail?name=asmack-2010.05.07.jar

Be careful about the userID.

Instead of using

connection.login("username@ejabberdServerIP",password)

it's work for me only if I use connection.login("username",password);

Good luck...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!