Smack+ejabberd in Ubuntu 12.04

Hi,

I’m trying to write a simple XMPP client to communicate with the Ejabberd server in Ubuntu 12.04. But i’ve always a problem during the login step. my code is like that:

ConnectionConfiguration config = new ConnectionConfiguration(“127.0.0.1”,5222,“localhost”);

connection = new XMPPConnection(config);

connection.connect();

connection.login(toto, toto);

manager = new FileTransferManager(connection);

}

and the result is:

anyoen could tell me what’s exactly the problem and how can I fix it? Thank you very much.

and the result is:
This is an error response to an xmpp ping. Not the cause your login failes. Which version of Smack do you use? Did you get any exception?

instead of this try using

your hostname instead … as ejabberd uses DNS to do the ip lookup.

ConnectionConfiguration(“yourhostname”,5222);

also to be on safer side update your /etc/hosts file with your hostname and the IP address.