powered by Jive Software

Unable to join MUC

Hello, I am trying to create a small android chat application connected to an openfire server. I was on smack 4.1 and the connections were working fine … i updated to smack 4.2 and added all the changes.

I am currently facing two issues :

where talk.fake.address is the real address

ONE:

When i try to connect to openfire server sometimes i receive :

SMACKException: The following addresses failed: '_xmpp-client._tcp.talk.fake.address:5222' failed because: de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for _xmpp-client._tcp.talk.fake.addresss.  IN SRV yielded an error response NX_DOMAIN

Somehow smack is adding _xmpp-client._tcp to my domain link and sometimes it doesn’t which causes error in connecting to the server (sometimes) .

TWO:

When i try to join a room :

Resourcepart resourcepart = Resourcepart.from(userName);
MucEnterConfiguration.Builder mucEnterConfigurationBuilder = multiUserChat.getEnterConfigurationBuilder(resourcepart);
mucEnterConfigurationBuilder.requestHistorySince(since);
mucEnterConfigurationBuilder.timeoutAfter(10000); multiUserChat.join(mucEnterConfigurationBuilder.build());
multiUserChat.addMessageListener(chatFragment);
multiUserChat.addPresenceInterceptor(new PresenceListener() {
   @Override
   public void processPresence(Presence presence) {
  Log.e("presence","interceptor:" + presence.toString());
  }
});
multiUserChat.addParticipantListener(new PresenceListener() {
   @Override
   public void processPresence(Presence presence) {
  Log.e("presence","presence:" + presence.toString());
  }
});
return multiUserChat.isJoined();

CASE 1 :

if i place the interceptors after joining the room, i just get a timeout :

03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err: org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). Waited for response using: AndFilter: (StanzaTypeFilter: Presence, OrFilter: (AndFilter: (FromMatchesFilter (ignoreResourcepart): 192a8e4e2ec795499c8161a4df3d68604c31p0u5xr220000@conference.talk.staging.wefoot.fr, MUCUserStatusCodeFilter: status=110), AndFilter: (FromMatchesFilter (full): 192a8e4e2ec795499c8161a4df3d68604c31p0u5xr220000@conference.talk.staging.wefoot.fr/deadlyscorpion_19923147, StanzaIdFilter: id=bMQxz-6, PresenceTypeFilter: type=error))).
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:253)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at org.jivesoftware.smackx.muc.MultiUserChat.enter(MultiUserChat.java:346)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at org.jivesoftware.smackx.muc.MultiUserChat.join(MultiUserChat.java:702)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at team.wefoot.co.xmpp.MyXMPP.joinMultiUserChatRoom(MyXMPP.java:286)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at team.wefoot.co.ChatFragment.joinChat(ChatFragment.java:313)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at team.wefoot.co.ChatFragment.onCreateView(ChatFragment.java:157)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.support.v4.app.Fragment.performCreateView(Fragment.java:2189)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:757)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2355)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2146)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2098)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1979)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:626)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:143)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.support.v4.view.ViewPager.populate(ViewPager.java:1268)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.support.v4.view.ViewPager.populate(ViewPager.java:1116)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.support.v4.view.ViewPager.setAdapter(ViewPager.java:540)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at team.wefoot.co.GameActivity.onSuccess(GameActivity.java:260)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at team.wefoot.co.participants.presenter.ParticipantPresenter.onSuccess(ParticipantPresenter.java:65)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at team.wefoot.co.participants.ParticipantInteractor.onResponse(ParticipantInteractor.java:194)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.os.Handler.handleCallback(Handler.java:739)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.os.Looper.loop(Looper.java:148)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:7406)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
03-20 10:21:38.789 31416-31416/team.wefoot.co.wefoot W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

CASE 2 :

if i place the interceptors before joining the room, i get a timeout but in this case :

i get all the history correctly and all the messages yet i still get the reply timeout above.

If i put the reply timeout to more than 10 seconds … lets say 20 seconds … during those 20 seconds i can send and receive messages to the server as if i am joined in the chatroom.

Somehow smack is adding _xmpp-client._tcp to my domain link and sometimes it doesn’t which causes error in connecting to the server (sometimes) .
See RFC 6120 § 3.2.1 and Smack’s source.

When i try to join a room :

Please provide a relevant XMPP trace. See How to ask for help, report an issue and possible solve the problem yourself · igniterealtime/Smack Wiki · GitHub

1 Like

Hello @Flow,

Thank you for your answer, i understand now from RFC 6120.

As for the second question.

Openfire Version: 4.1.3

Smack Version :4.2.0

I am sending presence to server like this and receive a presence back

03-22 11:02:40.760 18475-18695/team.wefoot.co.wefoot D/SMACK: SENT (0): <presence to='16164b1b4f714e741c3934f3c83fc9ad858mop2b99g33@conference.localhost/deadlyscorpion18590' id='IFJzs-25'><x xmlns='http://jabber.org/protocol/muc'><history since='2017-03-22T09:36:53.495+00:00'/></x><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.igniterealtime.org/projects/smack' ver='NfJ3flI83zSdUDzCEICtbypursw='/></presence>
03-22 11:02:40.780 18475-18696/team.wefoot.co.wefoot D/SMACK: RECV (0): <presence to="deadlyscorpion18590@localhost/21900c34-6476-4df9-b6db-252afad84224" id="IFJzs-6" from="16164b1b4f714e741c3934f3c83fc9ad858mop2b99g33@conference.localhost/deadlyscorpion18590"><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.igniterealtime.org/projects/smack" ver="NfJ3flI83zSdUDzCEICtbypursw="/><x xmlns="http://jabber.org/protocol/muc#user"><item jid="deadlyscorpion18590@localhost/21900c34-6476-4df9-b6db-252afad84224" affiliation="owner" role="moderator"/></x></presence>

When i receive this presence i receive after it the history of the chat as messages (as it should ) and i am able to send messages to the MUC and receive messages

But after 10 seconds i receive a reply timeout :

03-22 11:02:47.500 18475-18589/team.wefoot.co.wefoot W/System.err: org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). Waited for response using: AndFilter: (StanzaTypeFilter: Presence, OrFilter: (AndFilter: (FromMatchesFilter (ignoreResourcepart): 16164b1b4f714e741c3934f3c83fc9ad858mop2b99g33@conference.localhost, MUCUserStatusCodeFilter: status=110), AndFilter: (FromMatchesFilter (full): 16164b1b4f714e741c3934f3c83fc9ad858mop2b99g33@conference.localhost/deadlyscorpion18590, StanzaIdFilter: id=IFJzs-25, PresenceTypeFilter: type=error))).
03-22 11:02:47.500 18475-18589/team.wefoot.co.wefoot W/System.err:     at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:253)
03-22 11:02:47.500 18475-18589/team.wefoot.co.wefoot W/System.err:     at org.jivesoftware.smackx.muc.MultiUserChat.enter(MultiUserChat.java:346)
03-22 11:02:47.500 18475-18589/team.wefoot.co.wefoot W/System.err:     at org.jivesoftware.smackx.muc.MultiUserChat.join(MultiUserChat.java:702)

And the client is no longer joined in the MUC room and therefore can’t send and receive messages.

I downgraded Openfire to version 4.1.2 and the joining of the room worked but it doesn’t get the history of the chat anymore.

Your time is highly appreciated!

That’s probably an Openfire bug, it does not include the 110 MUC user status.

1 Like

Thank you, i will add it to the openfire section.

@Danial How to include the 110 MUC user status in openfire? have you any idea?

How to include the 110 MUC user status in openfire? have you any idea? please,i need your help,i got it that NoResponse when joinroom,Smack4.2.3 NoResponseException when joinroom

Hey guys, @ximo @bhavesh_spaceo , i don’t why but after i check the presence the join is work great even with request history function.
Till bug fixed i think is right for now because you can make a temp fix on your client side for those presence messages.
Have fun!

If you get SmackException$NoResponseException while join room means your presence is not updated to the server.
When SmackException$NoResponseException exception come send your presence “unavailable” to server and then send presence “available”. Then try to join the group.