【问题标题】:XMPP UserSearch using latest smack 4.1.3 got remote server no found errorXMPP UserSearch using latest smack 4.1.3 got remote server no found 错误
【发布时间】:2015-08-25 19:37:13
【问题描述】:

这是我正在使用的: 开火 3.10.2 拍打 4.1.3 环境:安卓

我正在尝试搜索注册用户,但一直未能成功。我尝试了很多不同的组合。我还尝试了旧版本的 smack。 这是我最新修改的代码:

UserSearchManager userSearchManager = new UserSearchManager(connection);
    Form searchForm = null;
    List<ReportedData.Row> list = null;
    try {
        userSearchManager.getSearchForm("search." + connection.getServiceName());
        Form answerForm = searchForm.createAnswerForm();
        answerForm.setAnswer("Username", true);
        answerForm.setAnswer("search", userName);
        answerForm.setAnswer("Name", true);
        answerForm.setAnswer("search", userName);
        ReportedData data = userSearchManager.getSearchResults(answerForm, "search." + connection.getServiceName());
        list = data.getRows();
    } catch (SmackException.NoResponseException e) {
        e.printStackTrace();
    } catch (XMPPException.XMPPErrorException e) {
        Log.e(LOG_TAG, e.getMessage());

    } catch (SmackException.NotConnectedException e) {
        Log.e(LOG_TAG, e.getMessage());
    }

我会收到这个错误 org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: remote-server-not-found - 取消 在线,

    Form searchForm = manager.getSearchForm("search." + connection.getServiceName());

我不知道我是否错过了在 openfire 服务器上配置某些内容,或者我是否需要在开始搜索之前进行设置。 我的解决方法是获取注册用户的完整列表,然后从那里搜索,但我不确定如何实现。 登录后,名册仅包含我的朋友和群组。 有人能指出我正确的方向吗?

【问题讨论】:

    标签: android xmpp openfire smack asmack


    【解决方案1】:

    您正试图在服务器 "search." + connection.getServiceName() 上搜索用户,但您的服务器告诉您它找不到该服务器。您似乎没有在 OpenFire 中设置搜索服务器,或者您使用了错误的地址。

    【讨论】:

    • 感谢 @xnyhps 我忘记在 openfire 服务器中安装搜索插件了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-08-13
    • 2017-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-24
    • 1970-01-01
    相关资源
    最近更新 更多