Openfire --用户登录返回roster为空

来源:互联网 发布:淘宝代码生成器 编辑:程序博客网 时间:2024/05/17 19:57

【问题描述】

Openfire日志(Debugger Plugin):

C2S - RECV (3696162): <iq id="67bo5-2" type="get"><query xmlns="jabber:iq:roster"></query></iq>
INTERPRETED: <iq id="67bo5-2" type="get" from="zjx@10.10.122.171/Spark 2.6.3"><query xmlns="jabber:iq:roster"/></iq>

C2S - SENT (3696162): <iq type="result" id="67bo5-2" to="zjx@10.10.122.171/Spark 2.6.3"><query xmlns="jabber:iq:roster"/></iq>


【问题分析】

IQRosterHandler——

 * Implements the TYPE_IQ jabber:iq:roster protocol. Clients
 * use this protocol to retrieve, update, and rosterMonitor roster
 * entries (buddy lists). The server manages the basics of
 * roster subscriptions and roster updates based on presence
 * and iq:roster packets, while the client maintains the user
 * interface aspects of rosters such as organizing roster
 * entries into groups.


 private IQ manageRoster(org.xmpp.packet.Roster packet) throws UnauthorizedException,
            UserAlreadyExistsException, SharedGroupException {

         ......

        if ((sender.getNode() == null || !RosterManager.isRosterServiceEnabled() ||  <--此处isRosterServiceEnabled返回false,导致后面空roster回复
                    !userManager.isRegisteredUser(sender.getNode())) &&
                    IQ.Type.get == type) {
                // If anonymous user asks for his roster or roster service is disabled then
                // return an empty roster
                IQ reply = IQ.createResultIQ(packet);
                reply.setChildElement("query", "jabber:iq:roster");
                return reply;


继续:

    public static boolean isRosterServiceEnabled() {
    boolean bRet = JiveGlobals.getBooleanProperty("xmpp.client.roster.active", true); <--原来“系统属性”-->"xmpp.client.roster.active"被置为false了

        return bRet;
    }


【解决方案】

“系统属性”-->"xmpp.client.roster.active"置为true,收发报文正确

C2S - RECV (2944378): <iq id="j9O8X-2" type="get"><query xmlns="jabber:iq:roster"></query></iq>
INTERPRETED: <iq id="j9O8X-2" type="get" from="zjx@10.10.122.171/Spark 2.6.3"><query xmlns="jabber:iq:roster"/></iq>
C2S - SENT (2944378): <iq type="result" id="j9O8X-2" to="zjx@10.10.122.171/Spark 2.6.3"><query xmlns="jabber:iq:roster"><item jid="wfp@10.10.122.171" name="wfp" subscription="both"><group>Friends</group></item></query></iq>


但是spark客户端在A电脑登录还是无法显示其roster,同一账号在B电脑上登录就显示正常;

尝试将C:\Users\lenovo\AppData\Roaming\Spark下的内容删除,同时重装spark,问题依然;

后面尝试在A中Spark面板 -->联系人 -->显示离线用户 选项勾选,即能够正常看到roster;但是B中没有勾选却能正常显示。估计此为spark的bug

0 0
原创粉丝点击