powered by Jive Software

MUC Config Form Problem

I’'m currently using smack 1.4.0 and have been following the documentation on creating a MUC conference room.

The code (below) found in the documentation under “MUC-Creating a room” throws an exception on “submitForm.setAnswer(field.getVariable(), values);”:

java.lang.IllegalArgumentException: This field only accept list of values.

I’'ve tried changing what type of variable is set in the setAnswer, but I have been unable to fix the problem.

Any help would be appreciated

// Create a MultiUserChat using an XMPPConnection for a room

  MultiUserChat muc = new MultiUserChat(conn1, "myroom@conference.jabber.org");

// Create the room


// Get the the room’'s configuration form

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) {

// Add the field values to a List

List values = new ArrayList();

for (Iterator it = field.getValues(); it.hasNext():wink: {

values.add((String) it.next());


// Sets the new answer to the form to submit

submitForm.setAnswer(field.getVariable(), values);



// Send the completed form (with default values) to the server to configure the room



It seems that the documentation is outdated. Anyway, the example in the documentation is not intended for a real case scenario. If you need to create a room with the default values provided by the service then just create an instant room. On the other hand, if you need to configure a room with some custom configuration you will need to put real values to the form fields. Just make sure to pass the correct datatype that the field is expecting. For instance, if the field expects a boolean you should send a boolean as a value. That’'s the problem with the example provided in the documentation which is always passing a list of strings.

Let me know if you need help creating a room.


– Gato