我試圖在Android上使用asmack庫實現一個簡單的jabber messenger。下面的代碼:(a)Smack在登錄處返回「service-unavailable(503)」錯誤
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後,我得到()(連接看起來不錯):
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)
可能是什麼錯誤呢?
坎請你添加更多的細節?你試圖連接什麼服務器,你確定要指定正確的端口/域/主機嗎?通常服務不可用意味着它可以被達到或您指定了錯誤的信息。 – Guillaume