如何在本地服务器上使用 Smack API UserSearchManager?
这可能看起来是一个非常基本的问题,但我在使用以下代码访问 OpenFire 搜索功能时遇到问题:
try {
UserSearchManager search = new UserSearchManager(connection.getConnection());
Form searchForm = search.getSearchForm("search." + server);
...
} catch (Exception e) {...}
这里的服务器是一个字符串,其值类似于“192.168.242.132”,代码从这一行获取错误:Form searchForm = search.getSearchForm("search." + server);
本质上,服务器已启动并运行,因为我可以创建帐户和登录/注销。
我认为问题出在“server”字符串值上。有人遇到过这种问题吗?
编辑:我已经在 /etc/hosts 中添加了将 IP 地址解析为 myelastix-local.com 的功能,但仍然遇到同样的问题,它可以访问 create / login api 但搜索仍然无法工作。我还必须修改 openfire 服务器设置吗?
This may look a very basic question but I am having a problem accessing OpenFire search function using this code:
try {
UserSearchManager search = new UserSearchManager(connection.getConnection());
Form searchForm = search.getSearchForm("search." + server);
...
} catch (Exception e) {...}
The server here is a String with value something like "192.168.242.132", the code gets error from this line: Form searchForm = search.getSearchForm("search." + server);
Essentially, the server is up and running as I can create account and login/logout.
I assume that the problem is with the "server" String value. Any one have encountered this kind of problem before?
EDIT: I have already added in /etc/hosts to resolve the IP address to myelastix-local.com and still having the same problem, it can access create / login api but search still does not work. Do I have to modify openfire server settings too?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您确定可以使用 IP 调用
getSearchForm()
吗?尝试提供组件 ID,通常类似于"search.jabberserver.tld"
Are you sure that you can call
getSearchForm()
with an IP? Try to provide the component ID, which is normally something like"search.jabberserver.tld"
这就是我所做的:
连接是 XMPPConnection。
Here's what I did:
connection is the XMPPConnection.