Connection Problems

I’'ve been reading others posts particularly on connection problems but none of them have seemed to solve my problem. Here is a version of my code:

try {

org.jivesoftware.smack.SSLXMPPConnection thisConn = new org.jivesoftware.smack.SSLXMPPConnection(“server”);

// thisConn.login(“login”, “pass”);

}

catch (Exception ex) {

out.print(“Error!
”);

ex.printStackTrace();

}

The error I’'m getting says:

org.jivesoftware.smack.XMPPException: Connection failed. No response from server. at org.jivesoftware.smack.PacketReader.startup(PacketReader.java:182)…

What could be my problem? Why is the server unable to complete the connection? I’'ve tried hitting jabber.org and jivesoftware.com. Please help.

-Victorious1

You may be behind a firewall that won’'t allow you to make connections over ports 5222 (normal XMPP) or 5223 (SSL XMPP). You could test this by trying to use a standard XMPP client such as Exodus from the same network.

Regards,

Matt

I actually have a client (Miranda) that has no problem connecting. Is there anything that can possibly be missing from my code or is there a library that I need to import? Thanks.

-Victor

Victor,

If you are trying to connect to jabber.org the problem could be that jabber.org is using an expired certificate. Smack by default won’'t let you establish a connection using an expired certificate.

You can point your browser to https://jabber.org:5223 in order to inspect the certificate.

The SSLXMPPConnection class uses a DummyTrustManager which accepts certificates without any validation except date validation. A quick solution could be to modify the #isServerTrusted method in order to accept invalid certificates (if this is your case).

Regards,

– Gato