powered by Jive Software

GroupChat Join Error

Hi,

I have a bug trying to join with GroupChat. I tried a work around it thinking it is time related but it didn’'t help. I get the room roster fine in the debug window but the method is throwing an Exception.

I added getJoin to the API so I am interrogating it in the loop.

Thanks a bunch,

Ted

Buildfile: build.xml

run:

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

/** A class that handles the sending of packets from the server.

It is running on its own thread as to free the server to handle

calls with out interruption

*/

public class GroupChatClient extends JPanel implements PacketListener, Runnable, ActionListener, KeyListener, ListSelectionListener, myJAB {

public GroupChatClient(TedsJabber client, XMPPConnection connection, String room){

this.connection = connection;

this.client = client;

this.room = room;

buildUI();

}

public void run() {

int counter = 0;

int numToTry = 5;

try{

chat = new GroupChat(connection,room);

while(chat.getJoined() == false ){ // Found out it was needed so changed API and added the loop

++counter;

try{ // We will try to join for numToTry if failed propogate ex

chat.join(client.login.userName);

}

catch(XMPPException ex){

if (counter >= numToTry)

throw ex;

}

}//while

chat.addMessageListener(this);

chat.addParticipantListner(this);

client.tabbedPane.add(room,this );

}

catch(XMPPException ex){

System.out.println("in XMPP "+ex);

JOptionPane.showMessageDialog(null, “Failed to Join”+ex.getXMPPError().getMessage(),

“alert”, JOptionPane.ERROR_MESSAGE);

}

}

Here is the class
GroupChatClient.java (7268 Bytes)

Can you paste in the XML log? Maybe the server isn passing back something Smack isn’'t expecting. What server are you testing against?

Regards,

Matt

Thanks Matt,

Here is the whole thing from me getting on to the jabber.org server and on

<stream:stream xmlns=’‘jabber:client’’ xmlns:stream=’‘http://etherx.jabber.org/streams’’ from=’‘jabber.org’’ id=’‘1558062230’’>

<iq id=’‘uvE1g-0’’ type=’‘result’’><query xmlns=’‘jabber:iq:auth’’>tedweitz

<iq type=’‘result’’ id=’‘uvE1g-1’’/>

<presence to=’‘tedweitz@jabber.org’’ from=’‘stpeter@jabber.org/work’’>IETF-ingdnd1<x stamp=’‘20030514T19:47:53’’ from=’‘stpeter@jabber.org/work’’ xmlns=’‘jabber:x:delay’’/>

<iq from=’‘tedweitz@jabber.org/Home’’ id=’‘uvE1g-3’’ type=’‘result’’><query xmlns=’‘jabber:iq:roster’’><item subscription=’‘both’’ name=’‘tedme’’ jid=’‘tedme@jabber.org’’>Friends<item subscription=’‘both’’ name=’‘tedme2’’ jid=’‘tedme2@jabber.org’’/><item subscription=’‘both’’ name=’‘tedster’’ jid=’‘tedster@jabber.org’’>IMDevelopers<item subscription=’‘both’’ name=’‘stpeter’’ jid=’‘stpeter@jabber.org’’>IMDevelopers

<presence from=’‘jdev@conference.jabber.org/andreea’’ to=’‘tedweitz@jabber.org/Home’’/>

<presence from=’‘jdev@conference.jabber.org/kibozer’’ to=’‘tedweitz@jabber.org/Home’’>dndbot0<pr esence to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/jasonatoffice’’>Im in the Office<presence to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/mankins’’/><presence to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/zion’’>its off to work I go2xa<presence from=’‘jdev@conference.jabber.org/ChatBot’’ to=’‘tedweitz@jabber.org/Home’’/><presence from=’‘jdev@conference.jabber.org/vapor’’ to=’‘tedweitz@jabber.org/Home’’>available<presence to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/BartVB’’>

Online

5

<presence from=’‘jdev@conference.jabber.org/evan’’ to=’‘tedweitz@jabber.org/Home’’/><presence from=’‘jdev@conference.jabber.org/mike.owens’’ to=’‘tedweitz@jabber.org/Home’’>Away as a result of idle.away<presence to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/andrew’’>Automatically away due to idle0away<x xmlns=’‘jabber:x:signed’’>iD8DBQAwq24UjUCivGfMsRAq9XAJ9X6vFEIJU8wY4TxNdtrIrAThiI3ACdGvIb

N3KYjRuEGiMYAL8Q+/Iwc=

=GlMk<presence to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/Loz’’>Awayaway<presence to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/jaxp’’>cenanding8<presence from=’‘jdev@conference.jabber.org/ulrich’’ to=’‘tedweitz@jabber.org/Home’’/><presence from=’‘jdev@conference.jabber.org/hildjj’’ to=’‘tedweitz@jabber.org/Home’’/><presence to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/ukscone’’>Extended Away8xa<presence from=’‘jdev@conference.jabber.org/tedweitz’’ to=’‘tedweitz@jabber.org/Home’’/><message type=’‘groupchat’’ to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/jaxp’’>hildjj: what content will you put in the new ‘‘translating exodus’’ page in its homepage?<x stamp=’‘20030514T20:54:40’’ from=’‘jdev@conference.jabber.org’’ xmlns=’‘jabber:x:delay’’>jdev@conference.jabber.org<message from=’‘jdev@conference.jabber.org/hildjj’’ id=’‘jcl_8’’ to=’‘tedweitz@jabber.org/Home’’ type=’‘groupchat’’>ask pgm.<x stamp=’‘20030514T20:54:50’’ from=’‘jdev@conference.jabber.org’’ xmlns=’‘jabber:x:delay’’>jdev@conference.jabber.org<message type=’‘groupchat’’ to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/jaxp’’>ok<x stamp=’‘20030514T20:55:11’’ from=’‘jdev@conference.jabber.org’’ xmlns=’‘jabber:x:delay’’>jdev@conference.jabber.org<message from=’‘jdev@conference.jabber.org’’ to=’‘tedweitz@jabber.org/Home’’ type=’‘groupchat’’>JDEV: welcome to the insane asylum! | Exodus 0.8.5.0 released (for real)pgmillard has set the topic to: JDEV: welcome to the insane asylum! | Exodus 0.8.5.0 released (for real)<message to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org’’ type=’‘groupchat’’>tedweitz has joined

<iq type=’‘get’’ to=’‘tedweitz@jabber.org/Home’’ id=’‘a1355a’’ from=’‘jdev@conference.jabber.org/BartVB’’>

<query xmlns=’‘jabber:iq:version’’/>

<presence from=’‘jdev@conference.jabber.org/tedweitz’’ id=’‘uvE1g-28’’ to=’‘tedweitz@jabber.org/Home’’/>

<presence from=’‘jdev@conference.jabber.org/tedweitz’’ id=’‘uvE1g-29’’ to=’‘tedweitz@jabber.org/Home’’/>

<presence from=’‘jdev@conference.jabber.org/tedweitz’’ id=’‘uvE1g-30’’ to=’‘tedweitz@jabber.org/Home’’/>

<presence from=’‘jdev@conference.jabber.org/tedweitz’’ id=’‘uvE1g-31’’ to=’‘tedweitz@jabber.org/Home’’/>

<presence from=’‘jdev@conference.jabber.org/Loz’’ to=’‘tedweitz@jabber.org/Home’’ type=’‘unavailable’’/>

<message to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org’’ type=’‘groupchat’’>Loz has left

<presence from=’‘jdev@conference.jabber.org/Loz’’ to=’‘tedweitz@jabber.org/Home’’/>

<message to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org’’ type=’‘groupchat’’>Loz has joined

<presence to=’‘tedweitz@jabber.org/Home’’ from=’‘art@conference.myjabber.net/tedweitz’’/>

<message type=’‘groupchat’’ to=’‘tedweitz@jabber.org/Home’’ from=’‘art@conference.myjabber.net’’>tedweitz is here

<presence to=’‘tedweitz@jabber.org/Home’’ id=’‘uvE1g-39’’ from=’‘art@conference.myjabber.net/tedweitz’’/>

<presence to=’‘tedweitz@jabber.org/Home’’ id=’‘uvE1g-40’’ from=’‘art@conference.myjabber.net/tedweitz’’/>

<presence to=’‘tedweitz@jabber.org/Home’’ from=’‘movies@conference.myjabber.net/tedweitz’’/>

<message type=’‘groupchat’’ to=’‘tedweitz@jabber.org/Home’’ from=’‘movies@conference.myjabber.net’’>tedweitz is here

<presence to=’‘tedweitz@jabber.org/Home’’ id=’‘uvE1g-44’’ from=’‘art@conference.myjabber.net/tedweitz’’/>

<presence to=’‘tedweitz@jabber.org/Home’’ id=’‘uvE1g-45’’ from=’‘movies@conference.myjabber.net/tedweitz’’/>

<presence to=’‘tedweitz@jabber.org/Home’’ id=’‘uvE1g-46’’ from=’‘art@conference.myjabber.net/tedweitz’’/>

<presence to=’‘tedweitz@jabber.org/Home’’ id=’‘uvE1g-47’’ from=’‘movies@conference.myjabber.net/tedweitz’’/>

<presence to=’‘tedweitz@jabber.org/Home’’ id=’‘uvE1g-48’’ from=’‘movies@conference.myjabber.net/tedweitz’’/>

<presence to=’‘tedweitz@jabber.org/Home’’ id=’‘uvE1g-49’’ from=’‘movies@conference.myjabber.net/tedweitz’’/>

<presence from=’‘jdev@conference.jabber.org/kibozer’’ to=’‘tedweitz@jabber.org/Home’’>dndbot0

<presence from=’‘jdev@conference.jabber.org/kibozer’’ to=’‘tedweitz@jabber.org/Home’’>dndbot0

<presence to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/andrew’’>Online0<x xmlns=’‘jabber:x:signed’’>iD8DBQAwrGbUjUCivGfMsRAjgcAJ9bQvDkV/i2YtJr2QeK77D4DZ5NJgCfVy9j

XN549J/V3+hV/LYp/veXvaI=

=Cgs4

<presence from=’‘jdev@conference.jabber.org/kikeman’’ to=’‘tedweitz@jabber.org/Home’’/>

<message to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org’’ type=’‘groupchat’’>kikeman has joined

<presence from=’‘jdev@conference.jabber.org/kikeman’’ to=’‘tedweitz@jabber.org/Home’’ type=’‘unavailable’’/>

<message to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org’’ type=’‘groupchat’’>kikeman has left

Ted,

This is too much XML for me to look through. Can you pare it down to the important parts that you think are causing an error?

Here’'s the code I use to listen for a response after a join:

PacketFilter responseFilter = new AndFilter(
        new FromContainsFilter(room + "/" + nickname),
        new PacketTypeFilter(Presence.class));

Does the server not send a packet back like that?

Thanks,

-Matt

Thanks Matt,

After joining the xml recived is:

<presence from=’‘jdev@conference.jabber.org/andreea’’ to=’‘tedweitz@jabber.org/Home’’/>

<presence from=’‘jdev@conference.jabber.org/kibozer’’ to=’‘tedweitz@jabber.org/Home’’>dndbot& lt;/status>0

<presence to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/jasonatoffice’’>Im in the Office</presence

etc, etc for the whole roster.

What is the nickname in from?

Shouldn’'t it be just filterd on the room?

PacketFilter responseFilter = new AndFilter(

new FromContainsFilter(room + “/” + nickname),

new PacketTypeFilter(Presence.class));

The only thing I can see that could be wrong is that the server passes back the nickname in quotes. Why would it do that?

Shouldn’'t it be just filterd on the room?

Nope, a presence packet comes back with your nickname in it to indicate you’'ve joined the group chat.

-Matt

I am looking at the stuff I get from the server. First I log in and get my roster than I join the jdev group on this server. The from is from andrea and so on what am I missing?

<iq from=’‘tedweitz@jabber.org/Home’’ id=’‘uvE1g-3’’ type=’‘result’’><query xmlns=’‘jabber:iq:roster’’><item subscription=’‘both’’ name=’‘tedme’’ jid=’‘tedme@jabber.org’’>Friends<item subscription=’‘both’’ name=’‘tedme2’’ jid=’‘tedme2@jabber.org’’/><item subscription=’‘both’’ name=’‘tedster’’ jid=’‘tedster@jabber.org’’>IMDevelopers<item subscription=’‘both’’ name=’‘stpeter’’ jid=’‘stpeter@jabber.org’’>IMDevelopers

<presence from=’‘jdev@conference.jabber.org/andreea’’ to=’‘tedweitz@jabber.org/Home’’/>

<presence from=’‘jdev@conference.jabber.org/kibozer’’ to=’‘tedweitz@jabber.org/Home’’>dndbot0<pr esence to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/jasonatoffice’’>Im in the Office<presence to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/mankins’’/><presence to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/zion’’>its off to work I go2xa<presence from=’‘jdev@conference.jabber.org/ChatBot’’ to=’‘tedweitz@jabber.org/Home’’/><presence from=’‘jdev@conference.jabber.org/vapor’’ to=’‘tedweitz@jabber.org/Home’’>available<presence to=’‘tedweitz@jabber.org/Home’’ from=’‘jdev@conference.jabber.org/BartVB’’>

Online

Must be somthing I am doing wrong in the response. I do not look for a response to confirm that I joined OK.

All I say is join, OK now listen (Ignor the loop)

while(groupChat.getJoined() == false ){ // Found out it was needed so changed API and added the loop

++counter;

try{ // We will try to join for numToTry if failed propogate ex

groupChat.join(client.login.userName);

}

catch(XMPPException ex){

if (counter >= numToTry)

throw ex;

}

}//while

groupChat.addMessageListener(this);

groupChat.addParticipantListner(this);

Somthing must be wrong in my processPacket. I am sending to the room my msgs but I do not see them back from this method:

public void processPacket(Packet packet){

if((packet.getClass().getName()).equals("org.jivesoftware.smack.packet.Presence "))

setRoster();

else if((packet.getClass().getName()).equals(“org.jivesoftware.smack.packet.Message” )){

Message msg = (Message)packet;

client.timedCya(jabbing,"[ "msg.getFrom() " ] "+msg.getBody());

}

}

Where am I wrong?

Thanks,

Ted

Looks like join is not returning for some reason although it joins fine

As I loop on join we get this printout: I have no idea why?

run:

in GroupChatClient run line 46 Join Login: tedweitz

in GroupChatClient run line 46 Join Login: tedweitz

in GroupChatClient run line 46 Join Login: tedweitz

in GroupChatClient run line 46 Join Login: tedweitz

in GroupChatClient run line 46 Join Login: tedweitz

GroupChatClient line 59 Exception: org.jivesoftware.smack.XMPPExcept

ion: No response from server.

This appears to be the culprit:

<presence from=’‘jdev@conference.jabber.org/andreea’’ to=’‘tedweitz@jabber.org/Home’’/>

The quotes around the name are clearly wrong so Smack is unable to tell that the server let you into the room.

Regards,

Matt

Thanks Matt,

this name apears in Exodus also with these quotes. strange the only one that looks like that.

It apears that the error is before that though from all my frenetic debugging:

After creating the groupChat its participants count is 0, there are plenty people in this room and I can see their presence packets.

I can post to the room but do not see the replays.

Here is the run but I will attach the whole file as somthing is wrong with this code

public class GroupChatClient extends JPanel implements PacketListener, Runnable, ActionListener, KeyListener, ListSelectionListener, myJAB {

public GroupChatClient(TedsJabber client, XMPPConnection connection, String room){

this.connection = connection;

this.client = client;

this.room = room;

buildUI();

}

public void run() {

int counter = 0;

int numToTry = 5;

try{

groupChat = new GroupChat(connection,room);

if(groupChat != null){

System.out.println("in GroupChatClient run line 42 got participants num: "+ groupChat.getParticipantCount());

setRoster();

}

while(groupChat.getJoined() == false ){ // Found out it was needed so changed API and added the loop

++counter;

try{ // We will try to join for numToTry if failed propogate ex

System.out.println("in GroupChatClient run line 46 Join Login: " +client.login.userName);

groupChat.join(client.login.userName);

}

catch(XMPPException ex){

if (counter >= numToTry)

throw ex;

}

}//while

groupChat.addMessageListener(this);

groupChat.addParticipantListner(this);

client.tabbedPane.add(room,this );

}

catch(XMPPException ex){

System.out.println("GroupChatClient line 59 Exception: "+ex);

/*JOptionPane.showMessageDialog(null, “Failed to Join”+ex.getXMPPError().getMessage(),

“alert”, JOptionPane.ERROR_MESSAGE);*/

}

}

Thanks,

Ted
GroupChatClient.java (7820 Bytes)

Here is the system print out:

Buildfile: build.xml

run:

in GroupChatClient run line 42 got participants num: 0

in GroupChatClient run line 46 Join Login: tedweitz

in GroupChatClient run line 46 Join Login: tedweitz

in GroupChatClient run line 46 Join Login: tedweitz

in GroupChatClient run line 46 Join Login: tedweitz

in GroupChatClient run line 46 Join Login: tedweitz

GroupChatClient line 59 Exception: org.jivesoftware.smack.XMPPExcept

ion: No response from server.

I am not sure what is wrong somhow it does not see thats it logged in. I added some debugs and changed the way I connect, no diffrance:

src:

public void run() {

int counter = 0;

int numToTry = 5;

System.out.println("in GroupChatClient run line 38 is connected: "+ connection.isConnected());

System.out.println("in GroupChatClient run line 39 got room as: "+ room);

try{

groupChat = connection.createGroupChat(room);

System.out.println("in GroupChatClient run line 44 got groupChat room as: "+ groupChat.getRoom());

if(groupChat != null){

System.out.println("in GroupChatClient run line 47 got participants num: "+ groupChat.getParticipantCount());

setRoster();

}

while(groupChat.getJoined() == false ){ // There is a problem with join trying to use the loop

++counter;

try{ // We will try to join for numToTry if failed propogate ex

System.out.println("in GroupChatClient run line 55 Join Login: " +client.login.userName);

groupChat.join(client.login.userName);

}

catch(XMPPException ex){

if (counter >= numToTry)

throw ex;

}

}//while

groupChat.addMessageListener(this);

groupChat.addParticipantListner(this);

client.tabbedPane.add(room,this );

}

catch(XMPPException ex){

System.out.println("GroupChatClient line 59 Exception: "+ex);

/*JOptionPane.showMessageDialog(null, “Failed to Join”+ex.getXMPPError().getMessage(),

“alert”, JOptionPane.ERROR_MESSAGE);*/

}

}

printout:

Buildfile: build.xml

run:

in GroupChatClient run line 38 is connected: true

in GroupChatClient run line 39 got room as: JDev@conference.jabber.o

rg

in GroupChatClient run line 44 got groupChat room as: JDev@conferenc

e.jabber.org

in GroupChatClient run line 47 got participants num: 0

in GroupChatClient run line 55 Join Login: tedweitz

in GroupChatClient run line 55 Join Login: tedweitz

in GroupChatClient run line 55 Join Login: tedweitz

in GroupChatClient run line 55 Join Login: tedweitz

in GroupChatClient run line 55 Join Login: tedweitz

GroupChatClient line 59 Exception: org.jivesoftware.smack.XMPPExcept

ion: No response from server.