powered by Jive Software

Could not connect to google talk service

i am using Smack 3.0.2. I wrote a small test class but could not connect to the google talk. following is the code piece:

import org.jivesoftware.smack.*;

import org.jivesoftware.smack.sasl.*;

import java.util.*;

public class test1 {

/** Creates a new instance of test1 */

public test1() {


public static void main(String[] args) {

try {

ConnectionConfiguration config = new ConnectionConfiguration(“talk.google.com”, 5222, “gmail.com”);


XMPPConnection conn = new XMPPConnection(config);


} catch (Exception ex) {





now the exception information

XMPPError connecting to talk.google.com:5222.: remote-server-error(502) XMPPError connecting to talk.google.com:5222.

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

at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection. java:830)

at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1276)

at test1.main(test1.java:32)

Nested Exception:

java.net.ConnectException: Connection refused: connect

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)

at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)

at java.net.Socket.connect(Socket.java:519)

at java.net.Socket.connect(Socket.java:469)

at java.net.Socket.<init>(Socket.java:366)

at java.net.Socket.<init>(Socket.java:179)

at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection. java:815)

at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1276)

at test1.main(test1.java:32)

the connect() method returned an error. I where is the problem. Anyone who can help me make this solved?


Message was edited by: lqflqf
gateway.jar (1169950 Bytes)

Leave off config.setSecurityMode(ConnectionConfiguration.SecurityMode.required). If you look just a couple of threads down on the first page of the forum there is another google talk thread already where I posted a working example.