MUC Room creation issues

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():wink:

{

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():wink:

{

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

For an example on how to do this I would check out the Spark code from SVN :

http://www.igniterealtime.org/downloads/source.jsp

The RoomCreationDialog class should be a pretty good example of what you are trying to do.

Cheers,

Nate

Nate - thanks for response, but the response is not very helpful… let me elaborate more here:

Our Environment:

  1. Custom Chat client that is being built using OpenLaszlo (www.openlaszlo.org) - this client sends all requests via HTTP web servers to the backend OpenFire (this is not the case for Spark - so looking at Spark - RoomCreatinDialog - did not help us)

  2. Our application is deployed in cluster environment & hence we have more than 1 web servers that will need to connected to OpenFire server for sending & receiving of new messages for the user from MUC room

  3. One of the web server takes care of creating the room & the other web servers will join the room *** question #1 - as part of this room creation, we find weirdness when we make the group chat admin as the room owner or admin - it does not seem to work, which works in Windows environment but fails on Linux

  4. Each web server has a Group Chat Administrator - which is used to listen for all messages being posted for a room *** question #2 - do we need this listener for a room to retreive messages or is there an alternate way?

Basically - I’m looking for sample code for OpenFire client that talks to server via HTTP proxy & running in cluster environment

Thanks

Bhaskara