powered by Jive Software

Unable to create persistent room with Smack 4.2.4


Hi Team,
I am unable to create a persistent room with below code snippet.

String groupServiceName = “goupName@conference.domainName”;
// Get the MultiUserChatManager
MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);
// Create a MultiUserChat using an XMPPConnection for a room
MultiUserChat multiUserChat = manager.getMultiUserChat(JidCreate.entityBareFrom(groupServiceName));
// Create the room
// Get the the room’s configuration form
Form form = multiUserChat.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().iterator(); 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.setAnswer(“muc#roomconfig_roomname”, “GroupB”);
submitForm.setAnswer(“muc#roomconfig_roomdesc”, “This is a Test Group”);
submitForm.setAnswer(“muc#roomconfig_publicroom”, true);
submitForm.setAnswer(“muc#roomconfig_persistentroom”, true);
submitForm.setAnswer(“x-muc#roomconfig_canchangenick”, true);
submitForm.setAnswer(“x-muc#roomconfig_registration”, true);

    catch (XmppStringprepException xse){
    catch (SmackException.NoResponseException nre){
    catch (XMPPException.XMPPErrorException xee){
    catch (MultiUserChatException.MucAlreadyJoinedException mucaje){
    catch (SmackException.NotConnectedException nce){
    catch (MultiUserChatException.MissingMucCreationAcknowledgeException mmcae){
    catch (MultiUserChatException.NotAMucServiceException namse){
    catch(InterruptedException ie){

And I am verifying persistent of the aforementioned room from Open Fire Admin Console, any suggestion will be helpful.


Can you give some more information, like what exactly doesn’t work, any exceptions that are thrown, or stanza logs?


Hi Paul,
Thanks for the quick reply. Please find the attached documents for stanza reference along with the screenshot of Open Fire MUC room summary which indicates that the created room is not of persistent type. Also, there was no exception in the log.

stanza_logs.txt (8.5 KB)


I’m not an expert in MUC related stuff, but the fact, that Openfire responded with an to the configure form suggests, that the room is in fact persistent. You could try to query the room config in Smack after configuring the room to see, if it is persistent.


Where in the screenshot exactly is this indicated?


I checked the configuration details of the room and I get the following info:
Room Name: GroupB
Room Desc: This is a Test Group
Is Room Persistent: false

We can see that except persistent attribute all other attributes are in place and please find the attached document which distinguishes the room created from Smack API(GroupB) and another one is created from Open Fire Admin Console(groupx).


Hi rohit.pandey, i’m facing the same problem.

Did you fix it?



Hi @rohit.pandey i found a workaround.

I tried:

instead of

answerForm.setAnswer(“muc#roomconfig_persistentroom”, true);

and it works fine. It’s a thing to Smack developers work.