powered by Jive Software

Can't connect to XMPP server in Smack 3.1.0 beta release

Great. The solution works.

Tested without proxy for Gtalk as wel as Jabber.org.

Thanx dimitar

Can’t get in from behind proxyl!!

Getting following exception:

not-allowed(405) Connection must be encrypted.
at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication .java:78)
at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 352)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:395)
at ClientTestProxy.main(ClientTestProxy.java:36)

Glad I can help

thanks you alot dimitar. i solved that problem in my application. could you send me the voice application which done on Smack-Jingle API. sandun1234u@yahoo.co.uk


The same problem: SASL authentication failed using mechanism DIGEST-MD5.

Is it really one solution!? So now we have to check all the servers for good login name (with or without you:)?

I also had (when i tryed to connect to another server) :

at org.jivesoftware.smack.util.Base64.encodeBytes(Base64.java:636)
at org.jivesoftware.smack.sasl.SASLMechanism.challengeReceived(SASLMechanism.java: 152)
at org.jivesoftware.smack.SASLAuthentication.challengeReceived(SASLAuthentication. java:492)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:338)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)

The funny thing is when i put my password in md5 it disappear (I only had “SASL authentication failed using mechanism DIGEST-MD5”).

Please help, the sooner the better, maybe in 3.1.1?

I have an account at Jabber.org and I’m seeing the same stack-trace when I try to connect. I looked through the source code and there seems to be an error in SASLMechanism.java. Right before line 152, where it tries to encode the response byte-array, it receives the response from evaluating the challenge byte-array. According to Java’s documentation on SaslClient.evaluateChallenge, returning a null byte-array is legal if the challenge succeeded. A null byte array passed into Base64.encodeBytes causes it to crash since it tries to get a length attribute (Base64.java:636) of the input array. I was able to make it work by applying the attached patch to SASLMechanism.java and putting the compiled class into an existing smack.jar file.
SASLMechanism.patch (847 Bytes)

Thank you chromus. I hope Smack 3.1.1 will solve this issue.

it really worked:)

I am using FreeProxy 3.92 Build 1644 (download link http://www.handcraftedsoftware.org/index.php?page=4&action=category&cat_id=2 ), and it works ok. Try it locally on your system, with ProxyInfo class, like this:

if you are using HTTP Proxy type you have to put null for username and password

ProxyInfo proxy = new ProxyInfo(ProxyType.HTTP, “proxy.host”, proxy.port, null, null);

if you are using SOCKS4/5 proxy then your proxy info should be like this (you can put empty string “” for usename and password if your proxy is without authentication)

ProxyInfo proxy = new ProxyInfo(ProxyType.SOCKS4/ProxyType.SOCKS5, “proxy.host”, proxy.port, “username”, “password”);

Then put the proxy object in your ConnectionConfiguration:

ConnectionConfiguration connConf = new ConnectionConfiguration(“jabber.server”, jabber.port, “jabber.service”, proxy); (jabber.service is usually same as jabber.server)

I recomend first you read the help for FreeProxy, and with FreeProxy you can establish local HTTP/SOCKS4/SOCKS5 proxy server, and you can test it.

I tried the gtalk code and it worked. But the code for jabber.org fails with this error:

SASL authentication failed using mechanism PLAIN:
at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 325)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:395)
at com.my.xmpp.XmppTest.main(XmppTest.java:30)

I made sure that I was using the ID w/o domain name. Are there multiple binary releases

of smack 3.1.0 beta? I’m using the version I just downloaded today.

for jabber.org try the foll. code

ConnectionConfiguration cc = new ConnectionConfiguration(“jabber.org”, 5222);

Then the rest of the code is the same.

Hope this helps, Cheers,


@earlenceferns, I tried your suggestion (by removing the third argument) and I got the same error …

for jabber.org try the foll. code

ConnectionConfiguration cc = new ConnectionConfiguration(“jabber.org”, 5222);

Edit: there was a problem with my account. I tried another account and it worked. Thanks for the help!

Hello everybody…

Forget about it, the problem is elsewhere.

But i’ll probably come back

Thanks for your help

Good patch!

Also, SASLMechanism.java line 149 calls sc.evaluateChallange(null), but the javadoc of evaluateChallenge says:

challenge The non-null challenge sent from the server. The challenge array may have zero length.”

This should be changed to:

sc.evaluateChallenge(new byte[0]);

Fixed SMACK-264 for trunk version on revision 11256.

Hi guys, I read carefully all you wrote, but couldn’t make anything here working fine, so about the solution, first you should download asmack library which is library for smack on Android, and Facebook chat works fine on this, where HOST= chat.facebook.com, domain is same and username/password is your username and password on facebook WITHOUT @chat.facebook.com if domain is entered as host(see up).But this can make troubles with Gtalk, because Gtalk requires “PLAIN” authentication and here is MD5 by default, so what?

No overriding methods , extending classes and so on just when initializing connection add this line

XMPPConnection connection = new XMPPConnection(connConfig);

         connConfig.setSASLAuthenticationEnabled(false);/// for gtalk and true for Facebook(or escape this line for Facebook with one IF clause)

Best regards, and please don’t post fake solutions guys, isn’t ethic make it work first Filip

Any timeframe for a 3.1.1 release?

IMO this is a quite serious regression (as it worked with 2.x) and its known and fixed since more than a year, but still no release?

Solution for google talk: Use good passwords!

I had this problem. But the strangeness was, that one account worked, and other accounts gave the error.

The password strength of the account that worked was “Strong

  • and the pw strength of the accoutn that did not work was “fair”.

I changed the password to a strong one for the not-working account, and that did the trick.

There is probably a good reason why. :slight_smile:

Best regards

Christian Liljedahl

I’m using the latest smack code from SVN (as of last Friday, May 14, 2010) and I’m unable to get connected to Jabber.org using exactly the code fragment in the post above (with only the username and password changed). The code works for connecting to GoogleTalk, but not Jabber.org. I get an exception on the login call, returning the classic SASL authentication PLAIN failed: invalid-authzid. I’ve decoded the BASE-64 and it looks correct as far as I can see.

Has something changed between the 3.1.0 release and the current code that may have broken this?

(Note that I’ve checked to make sure that Psi and Spark clients are able to connect to jabber.org using the same credentials.)

Anyone have any idea what is going on?

Has anyone gotten this to work at all for the android platform using the asmack libs? I fail on MD-5 sasl authentication no matter what I do

After hours of trial & error, I finally found a way to make all my gtalk accounts work with asmack (3.1.0) !

Problem was, that only some of my google accounts worked, while others didn’t (wrong password/id exception)

Some Accounts work when using “gmail.com” as ServiceName, while others only work when using “googlemail.com” !

–> Workaround: Try to connect with “gmail.com” first, if an exception is thrown, try to connect again with “googlemail.com


mConConfig = new ConnectionConfiguration(“talk.google.com”, “5222”, “gmail.com”);


XMPPConnection xmppCon = new XMPPConnection(mConConfig);

}catch(XMPPException e){
xmppCon.login(mUsername, mPassword, mResource);
}catch(XMPPException e){

            }else if(mService.equalsIgnoreCase("googlemail.com")){


1 Like