SMACK的SASL(DIGEST-MD5)身份验证错误

时间:2011-02-20 22:35:49

标签: xmpp smack sasl

  

可能重复:
  SASL Authentication failed while integrating facebook chat using Smack

我尝试编译此代码并始终引发此异常

  

SASL身份验证使用机制DIGEST-MD5失败:
      在org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:325)
      在org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:395)
      在org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:349)
      在SimpleConnection.main(SimpleConnection.java:31)

代码:

import javax.swing.JOptionPane;
import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.XMPPConnection;

import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.MessageListener;

import org.jivesoftware.smack.SASLAuthentication;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

public class SimpleConnection {

    static String username = "";
    static String password = "";

    public SimpleConnection() {
    }

    public static void main(String[] args) {
        try {

           SASLAuthentication.registerSASLMechanism("DIGEST-MD5", MySASLDigestMD5Mechanism.class);
            ConnectionConfiguration conf = new ConnectionConfiguration("chat.facebook.com", 5222);
            XMPPConnection con = new XMPPConnection(conf);
            con.connect();
            con.login(username, password);

            //Chat c = con.getChatManager().createChat("atopmax", new aa());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

我做错了什么?谢谢!

0 个答案:

没有答案