We have run into some serious issues in building our custom
chat front end. This happens during MUC room creation from our Java programs
using the smack API. The issue is as follows:
- We are
getting the exception when calling
“sendConfigurationForm” after trying to create
the room
- Exception
is “Conflict (409)”
Code / System environment:
- OpenFire
Version 3.3.0
- Admin
user trying to create the MUC room is a user in OpenFire, who has been made as “Group Chat”
administrator - in code below it is admin_s07@jacked.com
- We think
the problem is around trying to set our admin after the room creation using roomconfig_roomadmins
- Note - we
ran into “Forbidden (403)” last week when we tried to make the admin as room owner & that is when we
moved to making the admin as roomconfig_roomadmins
- Linux
CentOS
o Note: this
issue seem to happen only Linux machines only - seem to work fine when we test on Windows machine
We need your help in:
- Do you
see any issues in our code below for chat room creation?
- Are there
any known issues with smack API on Linux machine
We need your help ASAP on this… THANKS! h5. Source code that is creating the room:
final MultiUserChat muc = new MultiUserChat(m_connection,
chatRoomName);
m_admin = admin_s07@jacked.com;
if
(!chatRoomExists(chatRoomName.substring(0, chatRoomName.indexOf(’@’))))
{
try
{
muc.create(m_admin);
LOG.debug(“participants’ count=” +
muc.getOccupantsCount());
LOG.debug(“Chat Room created. Name=” +
chatRoomName);
Form form = muc.getConfigurationForm();
// Create a new form to submit based on the original form
Form submitForm = form.createAnswerForm();
// Add default answers to the form to submit
for (Iterator fields = form.getFields();
fields.hasNext()
{
FormField field = (FormField) fields.next();
if (!FormField.TYPE_HIDDEN.equals(field.getType())
&& field.getVariable() != null)
{
// Sets the default value as the answer
submitForm.setDefaultAnswer(field.getVariable());
}
}
submitForm.setAnswer(“muc#roomconfig_changesubject”,
true);
submitForm.setAnswer(“muc#roomconfig_allowinvites”,
true);
submitForm.setAnswer(“muc#roomconfig_persistentroom”,
true);
List<String> list = new ArrayList<String>();
if (null != maxUsers)
{
list.add(maxUsers.toString());
}
else
{
list.add(“0”);
}
submitForm.setAnswer(“muc#roomconfig_maxusers”, list);
List<String> admins = new ArrayList<String>();
admins.add(m_admin);
submitForm.setAnswer(“muc#roomconfig_roomadmins”, admins);
for (Iterator fields = submitForm.getFields(); fields.hasNext()
{
FormField field = (FormField) fields.next();
if (!FormField.TYPE_HIDDEN.equals(field.getType()) && field.getVariable() != null)
{
LOG.debug(field.getLabel() + “=” + field.getVariable() + “::” + field.toXML());
}
}
// Send the completed form (with default values) to the server to configure the room
muc.sendConfigurationForm(submitForm);
}
catch (XMPPException e)
{
LOG.error(“Failed to create the chat room. RoomName=” + chatRoomName , e);
LOG.error(“The RootCause is”, e.getCause());
return false;
}
muc.changeAvailabilityStatus("", Mode.dnd);
LOG.debug(“Chat Room creation form submitted. Name=” + chatRoomName);
}
The Exception we get is:
To add further the exception trace is:
12:18:00,876 ERROR GroupChatService:276 - [] Failed to
create the chat room. RoomName=1040341@conference.jacked.com
conflict(409)
at org.jivesoftware.smackx.muc.MultiUserChat.sendConfigurationForm(MultiUserChat.j ava:573)
at com.jacked.business.service.chat.GroupChatService.createChatRoom(GroupChatServi ce.java:272)
at com.jacked.web.util.ChatRoomController.createChatRooms(ChatRoomController.java: 231)
at com.jacked.web.util.ChatRoomController.run(ChatRoomController.java:101)
12:18:00,878 ERROR GroupChatService:277 - [] The
RootCause is
Thanks