问题描述
我想实现使用asmack库在Android上一个简单的闲聊使者。这里的code:
I'm trying to implement a simple jabber messenger on Android using asmack library. Here's the code:
public boolean login()
{
if (connection != null && connection.isConnected())
{
Log.i("XMPP", connection.getHost());
try
{
connection.login(USERNAME, PASSWORD);
}
catch (XMPPException e)
{
e.printStackTrace();
return false;
}
return true;
}
return false;
}
异常connection.login()后,我得到(连接看起来不错):
Exception I get after connection.login() (connection looks fine):
service-unavailable(503)
at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication.java:77)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:239)
at org.jivesoftware.smack.Connection.login(Connection.java:353)
at com.someapp.networking.XMPPMessenger.login(XMPPMessenger.java:60)
at com.someapp.XMPPService.onCreate(XMPPService.java:33)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2780)
at android.app.ActivityThread.access$3200(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1917)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
可能是什么错误?
What could be the mistake?
推荐答案
Asmack能够建立到服务器的新连接,但它落入<一href="http://fisheye.igniterealtime.org/browse/smack/trunk/source/org/jivesoftware/smack/XMPPConnection.java?r=12588#to212"相对=nofollow>非SASL模式由于某种原因( NonSASLAuthentication.authenticate的调用(NonSASLAuthentication.java:77)
)。我认为这就是服务器是想告诉你用服务不可用(503)的反应是,它不支持非SASL认证。
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.
尝试调试咂嘴为什么不尝试SASL认证。的
注:在咂嘴源代码查看器的线是有点过,因为过不同的版本,并从asmack补丁
Note: The lines in the smack source viewer are a bit off because off different versions and the patches from asmack.
这篇关于(一)拍击回报和QUOT;服务不可用(503)&QUOT;在登录错误()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!