默认
发表评论 2
想开发IM:买成品怕坑?租第3方怕贵?找开源自已撸?尽量别走弯路了... 找站长给点建议
基于XMPP的开源Smack库的IM登录时报错求助
阅读(42932) | 评论(2 收藏1 淘帖
现在客户确认ip 端口  用户名  都是正常的

         * 描述:初始化消息服务器连接
         * @throws Exception
         */
        public void initConnection() throws Exception{
                if(connection == null){
                        try{
                                ConnectionConfiguration connectionConfig = new ConnectionConfiguration(IP, PORT, domain);
                                connectionConfig.setReconnectionAllowed(false);
                                connectionConfig.setSendPresence(false);
                                connectionConfig.setSASLAuthenticationEnabled(false);
                                connectionConfig.setRosterLoadedAtLogin(false);
                                connection = new XMPPConnection(connectionConfig);
                                connection.connect();
                                connection.login(USERNAME, PASSWORD,RESOURCE + ((int)(Math.random()*90+10)));
                        } catch (XMPPException e) {
                                logger.error("连接消息服务器异常:" + e.getMessage(),e);
                                throw new Exception(e.getMessage());
                        }
                }
        }


报错信息
[IMBus] 2016-12-19 10:01:48 [ERROR] (SmackClient:84) 连接消息服务器异常:Server does not support compatible authentication mechanism.
Server does not support compatible authentication mechanism.:
        at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication.java:95)
        at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:212)
        at com.thinkive.im.smack.SmackClient.initConnection(SmackClient.java:82)
        at com.thinkive.im.smack.SmackClient.sendMessage(SmackClient.java:97)
        at com.thinkive.im.business.invs.BulkMessageThread.run(BulkMessageThread.java:40)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
        at java.lang.Thread.run(Thread.java:662)
[IMBus] 2016-12-19 10:01:48 [ERROR] (BulkMessageThread:43) 群发消息异常:Server does not support compatible authentication mechanism.
java.lang.Exception: Server does not support compatible authentication mechanism.
        at com.thinkive.im.smack.SmackClient.initConnection(SmackClient.java:85)
        at com.thinkive.im.smack.SmackClient.sendMessage(SmackClient.java:97)
        at com.thinkive.im.business.invs.BulkMessageThread.run(BulkMessageThread.java:40)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
        at java.lang.Thread.run(Thread.java:662)


即时通讯网 - 即时通讯开发者社区! 来源: - 即时通讯开发者社区!

K(C6)QL_M3YC)]@@}L~U2%S.png (80.37 KB, 下载次数: 831)

K(C6)QL_M3YC)]@@}L~U2%S.png
上一篇:即时通讯安全篇(六):非对称加密技术的原理与应用实践下一篇:如约而至:微信自用的移动端IM网络层跨平台组件库Mars已正式开源
推荐方案
评论 2
你需要把你的问题再明确一下:
1)你这是基于什么具体的技术(虽然我一看就知是Smack,但并不代表别人能看的出);
2)具体的lib版本;
3)具体的服务端是什么以及版本;
4)你要实现的是什么样的功能?
5)出现的原因是什么?是你自已改完代码后出错的,还是只是服务端配置可能不正确?
服务端和客户端的安全证书不一致?没玩过Openfire的加密传输,建议去找到官方的Demo代码。
现在还有人在用XMPP~~
签名: 该会员没有填写今日想说内容.
打赏楼主 ×
使用微信打赏! 使用支付宝打赏!

返回顶部