ASmack连接Openfire服务器异常

来源:互联网 发布:监理行业发展前景知乎 编辑:程序博客网 时间:2024/06/06 09:33

1.SASLError using DIGEST-MD5: not-authorized

增加

   SASLAuthentication.registerSASLMechanism("PLAIN", SASLPlainMechanism.class);   SASLAuthentication.supportSASLMechanism("PLAIN",0);

错误代码:
                        ConnectionConfiguration connConfig=new ConnectionConfiguration("192.168.1.111",5222);                        connConfig.setReconnectionAllowed(true);                        connConfig.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);                        connConfig.setSendPresence(true);                        XMPPConnection XMPPConnection = new XMPPTCPConnection(connConfig,null);                        XMPPConnection.connect();

改正后

                        ConnectionConfiguration connConfig=new ConnectionConfiguration("192.168.1.111",5222);connConfig.setReconnectionAllowed(true);connConfig.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);connConfig.setSendPresence(true);SASLAuthentication.registerSASLMechanism("PLAIN", SASLPlainMechanism.class);SASLAuthentication.supportSASLMechanism("PLAIN",0);XMPPConnection XMPPConnection = new XMPPTCPConnection(connConfig,null);XMPPConnection.connect();

2.SASL authentication failed using mechanism PLAIN

出现在登录时 onnect.login(account,password); 确认密码账号是否正确

0 0
原创粉丝点击