使用 Smack 4.1 创建新组时获取 SmackException NoResponseException
Posted
技术标签:
【中文标题】使用 Smack 4.1 创建新组时获取 SmackException NoResponseException【英文标题】:Getting SmackException NoResponseException while creating a new group using Smack 4.1 【发布时间】:2016-02-15 10:35:43 【问题描述】:我正在使用以下代码创建多用户组,但出现超时错误,即使我的超时错误是 10 秒。
public void createGroup()
String roomId = "Group_test003" + "@icoveri.com";
String nick = "Grouptest";
try
MultiUserChatManager manager = multiUserChatManager.getInstanceFor(connection);
MultiUserChat muc = manager.getMultiUserChat(roomId);
muc.create(nick);
Form form = muc.getConfigurationForm();
Form submitForm = form.createAnswerForm();
List<FormField> fields = form.getFields();
for (int i = 0; i < fields.size(); i++)
FormField field = (FormField) fields.get(i);
if (!FormField.Type.hidden.equals(field.getType()) && field.getVariable() != null)
submitForm.setDefaultAnswer(field.getVariable());
List owners = new ArrayList();
owners.add(user1234 + "@icoveri.com");
submitForm.setAnswer("muc#roomconfig_roomowners", owners);
muc.sendConfigurationForm(submitForm);
catch (XMPPException e)
e.printStackTrace();
catch (SmackException.NoResponseException e)
e.printStackTrace();
catch (SmackException.NotConnectedException e)
e.printStackTrace();
catch (SmackException e)
e.printStackTrace();
我得到的错误是
org.jivesoftware.smack.SmackException$NoResponseException: 无响应 在回复超时内收到。超时为 10000 毫秒(约 10 秒)。用过的 过滤器:AndFilter:(FromMatchesFilter(完整): Group_test003@iscoveri.com/Grouptest,StanzaTypeFilter: org.jivesoftware.smack.packet.Presence)。
在 org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:229) 在 org.jivesoftware.smackx.muc.MultiUserChat.enter(MultiUserChat.java:311) 在 org.jivesoftware.smackx.muc.MultiUserChat.createOrJoin(MultiUserChat.java:400) 在 org.jivesoftware.smackx.muc.MultiUserChat.createOrJoin(MultiUserChat.java:376)
【问题讨论】:
【参考方案1】:我已经找到了解决方案。问题出在我的服务中,即 iscoveri.com。我必须使用不同的服务名称来创建组。
【讨论】:
【参考方案2】:我也花了几个小时试图纠正同样的错误;就我而言,问题发生在我使用XMPPBOSHConnection
时,但不是在使用XMPPTCPConnection
时。
【讨论】:
以上是关于使用 Smack 4.1 创建新组时获取 SmackException NoResponseException的主要内容,如果未能解决你的问题,请参考以下文章