Problem sending chat message

Hi,

I am running JiveServer within an Application server.

I am using the following code to send a chat message:

XMPPConnection xmppConnection = new XMPPConnection(“localhost”);

xmppConnection.login(“visitor2”, “password”);

//visitor2 chatting with visitor1

xmppConnection.createChat(“visitor1@localhost”).sendMessage(res);

xmppConnection.close();

The chat message does not get to visitor1. The two

users being used in this example are already

created using the jive admin console. This code

works fine on a standalone jive server. Am I missing

something?

-manish

Hi,

Could you post the XML being sent and received? With Smack you can just set the System property smack.debugEnabled=true to get a Swing debug window that will show the XML traffic (e.g. java -jar -Dsmack.debugEnabled=true your-app.jar).

-iain

Hi iain,

I am also facing same problem, Here is the XML, though it has the subject and body, The Exodus client only recieved a notification that the user is now online, But it doesn’'t show the Message…

Can u please tell me where I am going wrong ?

Regards

Bhushan

<stream:stream to=“localhost” xmlns=“jabber:client” xmlns:stream=“http://etherx.jabber.org/streams”>

abhinao

abhinao3bd89f87885aa259349d ae61ef32b440423c5729Smack

Celine DeonNew Day Has Come…nL5zO0

</stream:stream>

Hi,

A few things.

First, could you also send the server XML (smack separates the client and server streams into separate windows and it helps to see what the server is sending in response)?

Second, please verify your client XML. I noticed there are spurious ‘’;’’ characters throughout your XML. Is that a cut and paste problem or are they really in the XML in the debug screen? If so, there appears to be a bug in the smack XML stream because those ‘’;’’ characters should not be there.

Third, verify your server domain. In your Messenger admin, log in and select “Server Manager | Server Properties”. Is your server name set to ‘‘localhost’’?

-iain

I think i have stumbled on the solution to this issue. I noticed that by putting delay between chat.sendMessage() and connection.close() i was able to get the message to be sent successfully each time. Does any body know if this is bug? I think it is a race issue. The connection gets closed before the message can be sent. I think the sentMessage() is done in a seperate thread. Is this the case?

  • TIA

Naresh.