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

【问题描述】

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="[email protected]/Spark 2.6.3"><query xmlns="jabber:iq:roster"/></iq>

C2S - SENT (3696162): <iq type="result" id="67bo5-2" to="[email protected]/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="[email protected]/Spark 2.6.3"><query xmlns="jabber:iq:roster"/></iq>
C2S - SENT (2944378): <iq type="result" id="j9O8X-2" to="[email protected]/Spark 2.6.3"><query xmlns="jabber:iq:roster"><item jid="[email protected]" 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

发布了46 篇原创文章 · 获赞 13 · 访问量 14万+

猜你喜欢

转载自blog.csdn.net/shineych/article/details/20560009
今日推荐