啪4.1 SASL验证错误 [英] Smack 4.1 SASL authentication error
问题描述
我使用啪4.1本机库为Android开发一个聊天应用程序。我可以把我的应用程序,我的服务器之间的连接,但我发现SmackException关于SASL认证,同时在登录。
I am using Smack 4.1 native library for android to develop a chat application. I'm able to set a connection between my application and my server but I'm getting SmackException regarding SASL authentication while logging in.
点要注意的。
- 在上有我的服务器端无需SASL认证。
- 在我的应用程序没有崩溃,但让我在我的日志猫snnippet图所示以下错误。
我使用的Eclipse露娜和JDK 1.7版本,我已经包含在libs文件夹下的库。
I'm using eclipse Luna and JDK version 1.7 and I have included the following libraries in the libs folder.
- jxmpp核-0.4.1
- jxmpp-UTIL缓存-0.4.1
- minidns-0.1.1
- 咂嘴,Android的4.1.0.jar
- 咂嘴,Android的扩展-4.1.0
- 嫌核-4.1.0
- 嫌-扩展-4.1.0
- 嫌-IM-4.1.0
- 嫌-TCP-4.1.0
这是我用来建立连接我的code。
This is my code which I'm using to establish a connection.
XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();
configBuilder.setUsernameAndPassword(userName, pass);
configBuilder.setSecurityMode(XMPPTCPConnectionConfiguration.SecurityMode.disabled);
configBuilder.setResource("testServices");
configBuilder.setServiceName(DOMAIN);
configBuilder.setPort(PORT);
configBuilder.setHost(DOMAIN);
configBuilder.setDebuggerEnabled(true);
AbstractXMPPConnection connection = new XMPPTCPConnection(
configBuilder.build());
/** Connecting to the server */
try {
connection.connect();
Log.i(TAG, "Connected to " + connection.getHost());
} catch (SmackException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (XMPPException e) {
Log.e(TAG, "Failed to connect to " + connection.getHost());
Log.e(TAG, e.toString());
e.printStackTrace();
}
/** LogingIn to the server */
try {
//SASLMechanism.PLAIN();
//SASLAuthentication.("PLAIN", 0);
connection.login(userName, pass);
// connection.login();
} catch (XMPPException e) {
e.printStackTrace();
} catch (SmackException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
/** LogingOut from the server */
connection.disconnect();
这是我的logcat输出。
This is my logcat output.
04-20 22:22:51.584: D/SMACK(8335): SENT (0): <stream:stream xmlns='jabber:client' to='my_server_url' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='10001@my_server_url' xml:lang='en'>
04-20 22:22:52.519: D/SMACK(8335): RECV (0): <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0" id="0768491716592086" from="my_server_url">
04-20 22:22:53.744: D/SMACK(8335): RECV (0): <stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism></mechanisms></stream:features>
04-20 22:22:53.749: I/(8335): Connected to "smy_server_url"
04-21 12:24:55.815: I/(16566): SmackException to my_server_link.comorg.jivesoftware.smack.SmackException: SASL Authentication failed. No known authentication mechanisims.
04-20 22:22:53.754: W/System.err(8335): org.jivesoftware.smack.SmackException: SASL Authentication failed. No known authentication mechanisims.
04-20 22:22:53.759: W/System.err(8335): at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:254)
04-20 22:22:53.759: W/System.err(8335): at org.jivesoftware.smack.tcp.XMPPTCPConnection.loginNonAnonymously(XMPPTCPConnection.java:365)
04-20 22:22:53.759: W/System.err(8335): at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:452)
04-20 22:22:53.759: W/System.err(8335): at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:427)
04-20 22:22:53.759: W/System.err(8335): at com.epixoft.ui.LoginActivity$ConnectionTestTask.doInBackground(LoginActivity.java:120)
04-20 22:22:53.759: W/System.err(8335): at com.epixoft.ui.LoginActivity$ConnectionTestTask.doInBackground(LoginActivity.java:1)
04-20 22:22:53.759: W/System.err(8335): at android.os.AsyncTask$2.call(AsyncTask.java:288)
04-20 22:22:53.759: W/System.err(8335): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
04-20 22:22:53.759: W/System.err(8335): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
04-20 22:22:53.764: W/System.err(8335): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
04-20 22:22:53.764: W/System.err(8335): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
04-20 22:22:53.764: W/System.err(8335): at java.lang.Thread.run(Thread.java:841)
04-20 22:22:53.784: D/SMACK(8335): SENT (0): <presence id='PwoLk-3' type='unavailable'><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.igniterealtime.org/projects/smack' ver='NfJ3flI83zSdUDzCEICtbypursw='/></presence>
04-20 22:22:53.789: D/SMACK(8335): SENT (0): </stream:stream>
04-20 22:22:53.864: E/ViewRootImpl(8335): sendUserActionEvent() mView == null
在此先感谢您的帮助。 欢呼:)
Thanks in advance for any help. cheers :)
推荐答案
挣扎了很多后,终于我找到了解决我的问题。
After struggling a lot finally i have found the solution to my problem.
我要导入嫌-SASL提供-4.1.0.jar
来摆脱这种SASLAuthentication错误的。
I have to import the smack-sasl-provided-4.1.0.jar
to get rid of this SASLAuthentication error.
这篇关于啪4.1 SASL验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!