powered by Jive Software

smack.SmackException$ ConnectionException thrown by XMPPConnection.connect();

i want to connect to a ejabberd server that worked with asmack 0.8.10.

but now with new version 4.0.0 the code does not work and throw an exception

the code is :

ConnectionConfiguration mConnectionConfiguration = new ConnectionConfiguration(“some address (like google.com)”, 5222);

mConnectionConfiguration.setDebuggerEnabled(true);

XMPPConnection mConnection = new XMPPTCPConnection(mConnectionConfiguration);

mConnection.connect(); //(here throw an exception)

and exception is:

06-17 12:02:56.924: W/System.err(10622): org.jivesoftware.smack.SmackException$ConnectionException

06-17 12:02:56.924: W/System.err(10622): at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPC onnection.java:431)

06-17 12:02:56.940: W/System.err(10622): at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection. java:799)

06-17 12:02:56.940: W/System.err(10622): at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:391)

06-17 12:02:56.940: W/System.err(10622): at com.example.testchat.MainActivity.test(MainActivity.java:121)

06-17 12:02:56.940: W/System.err(10622): at com.example.testchat.MainActivity.access$0(MainActivity.java:56)

06-17 12:02:56.940: W/System.err(10622): at com.example.testchat.MainActivity$1.run(MainActivity.java:34)

06-17 12:02:56.940: W/System.err(10622): at java.lang.Thread.run(Thread.java:856)

What could be the Problem?

Thanks

ConnectionException is thrown when Smack is unable to connect to one of the relevant hosts providing the XMPP service. You can get the list of failed HostAddresses with ConnectionException.getFailedAddresses() and the message of the exception causing the host to fail with HostAddresses.getErrorMessage().