powered by Jive Software

Will not join :(

What can I say, this is driving me nuts.

I can not join a room such that Smack will recognize it and will let me have the Roster.

Just downloaded the newest Smack, no difference. I added before a priority to the Smack login, I removed it. Now my Smack is new and original never the less it will not Join a room.

Maybe it will help so here is how the parent frame login:

login = loginSetter.getLogin();

connection = new XMPPConnection(login.server, login.port);

cya(jabbing, “[chacking for old messages]”);

connection.addPacketListener(this,myFilter);

try{

if(login.resource.equals("") || login.resource == null)

connection.login(login.userName, login.password);

else{ connection.login(login.userName, login.password ,login.resource /, login.priority/);}

}

(cya print messages to the users window)

Now when the user wants to join a room she clicks join which creates a new instance of the GroupChatClient and starts its thread

public class GroupChatClient extends JPanel implements PacketListener, Runnable, ActionListener, KeyListener,

ListSelectionListener, RosterListener, myJAB {

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

this.connection = connection;

this.client = client;

this.room = room;

buildUI();

}

public void run() {

try{

connection.addPacketListener(this,new OrFilter(new PacketTypeFilter(Message.class), new PacketTypeFilter(Presence.class )));

groupChat = connection.createGroupChat(room);

groupChat.addParticipantListner(this);

groupChat.addMessageListener(this);

groupChat.join(client.login.userName);

setRoster();

}

Here I try to join a room that sends a legal presence.

tedweitz is here

My Sytem.out shous the errors (I interogate isJoined every time)

run:

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

ion: No response from server.

Is GroupChat joined? :false

What can be wrong?

Thanks,

Ted

Ted,

What is the name of the server that you are trying to connect to? Can you please test with hardcoded values instead of using variables? That will make the code you paste in much more meaningful. Also, you should really be testing this in a MUCH simpler program rather than trying to use all the extra Swing code. The entire test program you should be using should be about 8 lines of code – such as the one I pasted into a previous thread.

What I see in the XML logs is that you are logged into jabber.org, but that you are trying to connect to a room at myjabber.net. Is that truly the case?

Regards,

Matt

Thanks Matt,

That is true. I am connected to jabber.org and try to connect to a room in jabber.net since they respond with a good presence. I communicate with this room after the connection fine. It just will not officially join.

The same with the jdev@jabber.org but you had a question about the response presence it sends back though John reportedly join this room fine.

The only thing I can think of is the threading that complicate things but I thought that I need it to allow multiple conversations to go on.

I will Zip up the whole thing it is very straight forward it looks for JAVA_HOME and having ant in the path.

Thanks a bunch Matt

Ted,

Unfortunately, I just don’‘t have time to take a closer look at the issue right now. However, I’‘m pretty positive the GroupChat class works in general since we’‘re using it ourselves. If you look at the source of GroupChat and add some debug info, you shouldn’‘t have too many problems narrowing down the issue quickly. Sorry I can’‘t be of more help. However, let me suggest again that you should do all your testing with a FAR simpler program than you’'re using now. The trick to finding bugs is to start really simple and then only add new functionality one piece at a time until you find the problem.

Regards,

Matt

Thanks Matt,

If you will get board give it a try, you will like it

I am to far in it I am not sure what I will do.

I may play with the thread that’s the only thing I see different do you guys use it in a multithreaded setting?

BTW when I leave a room I keep getting its messages how do I remove my connection from the room(leave()) didn’'t.

Thanks,

Ted

I’'ve taken a look at the project and the problem seems to be related to threads.

The room is actually connected and is getting the necessary packets in the “interpreted packets” list. What’‘s happening is that nextResult(5000) in the packetcollector wakes up and is still seeing an empty resultQueue even though you can see that the presence packet that it’‘s looking for has long since come across the wire. Changing the timeout doesn’'t change the behavior.

Interestingly, it only seems to happen on a busy room. If I connect to my local server with one other person in the room, it works without a problem.

On thing I can see is when I add a println to the processPacket in the packetcollector, each packet is hitting it from 9-14 times in a row.

The synopsis of what his program is doing is this:

Main prog.
groupChat = new GroupChatClient(this, connection, room);
Thread t = new Thread(groupChat);
t.setDaemon(false);
t.start(); public class GroupChatClient extends JPanel implements PacketListener, Runnable, ActionListener, KeyListener, ListSelectionListener, RosterListener, myJAB {   public GroupChatClient(TedsJabber client, XMPPConnection connection, String room){
      this.connection = connection;
      this.client = client;
      this.room = room;
      buildUI(); } public void run() {
  try{
    groupChat = connection.createGroupChat(room);
    groupChat.join(client.login.userName);
  }
  catch(XMPPException ex){           ex.printStackTrace();
  }
}
}

The groupChat.join line will block for however long you have the timeout and then generate the server timeout message.

I’‘ll keep investigating and let you know if I find anything but Ted should be the one to find the bug (wherever it may be) since it’'s his CS final!

John

John, what can I say?

You are incredible; I wish I was as knowledgeable as you swimming in this stuff. I was way over my head before I even started

I think I will try to create and join in the constructor and will listen in the Run. I am not good with threads but I think that will achieve the goal of having the class doing the ongoing blocking work on a separate thread the initial building of stuff can block the main for a little time.

I humbly thank you, (Its just a finale of one little course, you can just imagine )

Ted

No rest for the weary,

I tried to take the join out of the run then made the whole thing non threadable. No difference.

Now it just blocks for 30 sec then throws the exception and go to unoficialy communicate with the room.

Any idea guys? (I guess the weekend will be a Jabbed…

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

this.connection = connection;

this.client = client;

this.room = room;

buildUI();

groupChat = connection.createGroupChat(room);

connection.addPacketListener(this,new OrFilter(new PacketTypeFilter(Message.class), new PacketTypeFilter(Presence.class )));

groupChat.addParticipantListner(this);

groupChat.addMessageListener(this);

try{

groupChat.join(client.login.userName);

}

catch(XMPPException ex){

Well I’'ve certainly gotten an education on Java threads today, so not a waste of time. Besides, why we all program is so that we can pound out heads against hard objects

However, Matt held the key, start simple.

The problem, it turns out, has nothing to do with threads. It is that Ted’‘s program is passing "JDev@conference.jabber.org" for the room name, and FromContainsFilter is doing a case-sensitive compare (indexOf) but the proper room name is all lower case “jdev@…” and therefore isn’'t matching the packets.

Take care,

John

John,

What can I say…

Thank you! I owe you a pint, at least

Ever visited John Harvard? (This pub is so good they named the whole little school after him)

Ted

John,

Nice job finding this problem! Hmm, i wonder if we should handle the case issue somehow. Are all JID’‘s supposed to be case insensitive? If so, I’'ll change the packet filter implementation so that it works that way.

-Matt

Hey Matt,

You should see it now!!! It will bring tears to your eyes Thank you!

JIDS are case insensitive so probably converting all to lower case at the processing will be good.

The new thing now is that it echoes twice every group chat message and it takes a while to get the entire roster (It shows the first then hang for a while). Nevertheless it is awesome!

Thanks,

Ted

Ted,

The reason it’'s echoing twice is that you are registering a packetlistener (for messages and presence) as well as the GroupChat.addMessageListener and GroupChat.addParticipantListener. Deleting the addPacketListener line should fix your problem.

John

John,

Nice job finding this problem! Hmm, i wonder if we

should handle the case issue somehow. Are all JID’'s

supposed to be case insensitive? If so, I’'ll change

the packet filter implementation so that it works

that way.

-Matt

I just looked around and from what I can see, the node and domain parts are case-insensitive but the resource is case sensitive. I just tested with jabberd and the server allows multiple resource logins where the resource names only differ by case. Though I see a number of clients (including mine!) don’'t handle this properly. I also tested the conference server and it allows identical-except-for-case nicknames. Specifying the room name in different cases all end up in the same room.

I guess they might have wanted to go case sensitive but since DNS servers aren’'t they had to go this route.

John

John,

You are so incredibly helpful!!!

Thanks so much, I removed the double listening and it cured it. The stuff I was wrestling a lot this morning was the Roster It just wouldn t load and then I discovered the magic of

roster.reload();

Unreal, this API is so awesome, takes some time to get the hang of it. Ever thought of writing a manual for it…

As for Roster when I listen to presence and IQ the rosterListener doesn t seem to do anything,?

Just figured out how to handle the roster subscription now.

As for the project it was due Thursday…

public void processPacket(Packet packet){

else if (Presence.class.isInstance(packet)){

Presence presence = (Presence)packet;

// If we got request to subscribe will approve it here automatically

if(presence.getType() == Presence.Type.SUBSCRIBE){

String from = presence.getFrom();

presence.setFrom(presence.getTo());

presence.setTo(from);

presence.setType(Presence.Type.SUBSCRIBED);

connection.sendPacket(presence);

// Now will add to our roster

presence.setType(Presence.Type.SUBSCRIBE);

connection.sendPacket(presence);

}

setRoster();

}

This stuff is pure poetry

Thanks again John (and Matt!!!)

Hi,

As far as case goes, in the basic scenario (essentially the US-ASCII subset of UTF-8), the node is case insensitive while the resource is not. However that definition starts to break down when you talk about other languages where more than just simple case can be ‘‘folded’’. So the XMPP IETF working group has defined formal rules as a string prep profile (see node prep and resource prep - domains follow standard internet domain name conventions of equivalence):

http://www.jabber.org/ietf/

There is a free GNU stringprep implementation in C but I haven’'t found one for Java yet. If anyone finds one, please post to the forum!

-iain