Related question: Initialization exception "NoClassDefFoundError: javax.naming.directory.InitialDirContext" when using Smack 4.1 on Android
I use Smack 4.1.1 in my Android app and I get the following exception -
05-19 21:38:31.141 8330-8803/test W/SASLError﹕ Could not transform string 'bad_auth' to SASLError
java.lang.IllegalArgumentException: bad_auth is not a constant in org.jivesoftware.smack.sasl.SASLError
at java.lang.Enum.valueOf(Enum.java:192)
at org.jivesoftware.smack.sasl.SASLError.valueOf(SASLError.java:22)
at org.jivesoftware.smack.sasl.SASLError.fromString(SASLError.java:46)
at org.jivesoftware.smack.sasl.packet.SaslStreamElements$SASLFailure.<init>(SaslStreamElements.java:169)
at org.jivesoftware.smack.util.PacketParserUtils.parseSASLFailure(PacketParserUtils.java:789)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1032)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:937)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:952)
at java.lang.Thread.run(Thread.java:856)
05-19 21:38:31.221 8330-8766/test W/System.err﹕ org.jivesoftware.smack.sasl.SASLErrorException: SASLError using SCRAM-SHA-1: bad-auth
05-19 21:38:31.231 8330-8766/test W/System.err﹕ at org.jivesoftware.smack.SASLAuthentication.authenticationFailed(SASLAuthentication.java:365)
05-19 21:38:31.231 8330-8766/test W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1033)
05-19 21:38:31.231 8330-8766/test W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:937)
05-19 21:38:31.231 8330-8766/test W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:952)
05-19 21:38:31.231 8330-8766/test W/System.err﹕ at java.lang.Thread.run(Thread.java:856)
This is my current login code -
public void login(String username, String password) throws IOException, XMPPException, SmackException {
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword(username, password)
.setHost(SERVICE_NAME)
.setPort(5222)
.setServiceName(SERVICE_NAME)
.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
.build();
mConnection = new XMPPTCPConnection(config);
mConnection.connect();
mConnection.login();
mChatManager = ChatManager.getInstanceFor(mConnection);
mChatManager.addChatListener(this);
}
I tried using the Plain SASL mechanism -
SASLAuthentication.registerSASLMechanism (new SASLPlainMechanism ());
And also tried the following code:
SASLMechanism mechanism = new SASLDigestMD5Mechanism();
SASLAuthentication.registerSASLMechanism(mechanism);
SASLAuthentication.blacklistSASLMechanism("SCRAM-SHA-1");
SASLAuthentication.unBlacklistSASLMechanism("DIGEST-MD5");
All of them do not work.
iOS ( XMPPFramework) WPF ( S22). pidgin . , , - smack. , ?