Reconnect to groupchat

Hi,

I’‘m having this problem, not sure if it’'s smack, muc or my code but maybe you can help.

I’'m using smack 1.1.1.

In my group chat applet (jre-1.3.1) I’'m connecting to a group chat and all is ok the first time…joining, writing, messagelistener, participantslistener

After closing the window when I try joining the room again it gives me an error:

org.jivesoftware.smack.XMPPException: No response from server.

at org.jivesoftware.smack.GroupChat.join(GroupChat.java:184)

at org.jivesoftware.smack.GroupChat.join(GroupChat.java:148)

at ro.dc2.client.ui.ChatRoom.(ChatRoom.java:38)

at ro.dc2.client.ui.DC2.createNewRoom(DC2.java:185)

Here is a bit of the code from chat room:

myGroupChat=DC2Connection.conn.createGroupChat(roomName*"@"*DC2.CONFERENCE_SERVER);

try {

if (myGroupChat!=null && DC2Connection.conn.isConnected() && DC2Connection.conn.isAuthenticated()) {

myGroupChat.join(myName);

}

} catch (XMPPException ex) {

System.out.println("Cannot join room "+roomName);

DC2Connection is a singleton which handles the connection and it is not destroyed when closing the applet the first time.

Any ideea?

Forgot to mention: ChatRoom.java:38 is actually the line where I want to join the chatroom: myGroupChat.join(myName);

Dan,

Can you try upgrading to the latest Smack daily build as a first step? http://www.jivesoftware.com/xmpp/smack/dailybuilds.jsp

Also, make sure that you XMPP server is configured to allow new chat rooms to be created.

Regards,

Matt

Nope, still no luck.

I also tried to connect to the room with the timeout parameter.

The error changed to

org.jivesoftware.smack.XMPPException: No response from server.

at org.jivesoftware.smack.GroupChat.join(GroupChat.java:184)

at ro.dc2.client.ui.ChatRoom.(ChatRoom.java:38)

Any other suggestion before I go insane?

Dan

Dan,

I’‘d suggest turning on Smack debug and looking at the packets to see what is going wrong. You could also try a different server just to see if it’'s some sort of server problem. Jabber.org has a public XMPP server that lets you creates groupchat rooms, for example.

Regards,

Matt

Hi,

I’‘ve got it. I was adding a listener the first time and since the connection wasn’'t dropped when closing the chat room it was adding the listener again when reopened.

I told you it could be my code

Thanks for the help,

Dan