powered by Jive Software

Error in connecting to GMail - Connection refused


I tried to integrate Smack API on my web page, getting the following error:

Exception caught XMPPError connecting to talk.google.com:5222.: (502)

– caused by: java.net.ConnectException: Connection refused: connect

The source code is as follows:

import org.jivesoftware.smack.XMPPConnection;

import org.jivesoftware.smack.XMPPException;

import org.jivesoftware.smack.Chat;

public class Example3 {

public void createcon() throws XMPPException


XMPPConnection con = new XMPPConnection(“jabber.org”);

con.login(“username”, “password”);

 Chat chat = con.createChat("username@jivesoftware.com");

chat.sendMessage(“Hey, how’'s it going?”);


public static void main(String a[])


Example2 e = new Example2();





catch(Exception le)






Can you help me where i have gone wrong, do i need to configure any other pre-requisites or settings.

we also tried using the port number 5222, 5223, 443 but throws the same error.

Would like to know what is the port number that needs to be used.

Any other suggestions are welcome.

Thanks in advance


duplicate … my reply goes here: http://www.jivesoftware.org/community/thread.jspa?threadID=17905&tstart=0