powered by Jive Software

Could not connect to the xmpp server via smack xmpp in java

Good day. Im stuck with this problem and i can not solve it.

code:

SASLAuthentication.supportSASLMechanism(“PLAIN”, 0);

ConnectionConfiguration config = new ConnectionConfiguration(host, port);

config.setDebuggerEnabled(true);

config.setSASLAuthenticationEnabled(true);

config.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled);

XMPPConnection connection = new XMPPConnection(config);

try{

connection.connect();

connection.login(login, password);

}

catch (XMPPException exc){

exc.printStackTrace();

}

full stack trace:

/Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/bin/java -Didea.launcher.port=7544 “-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 11 CE.app/bin” -Dfile.encoding=UTF-8 -classpath “/Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/lib/deplo y.jar:/Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/lib/d t.jar:/Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/lib/j avaws.jar:/Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/l ib/jce.jar:/Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/ lib/jconsole.jar:/Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents /Home/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/1.6.0_35-b10-42 8.jdk/Contents/Home/lib/plugin.jar:/Library/Java/JavaVirtualMachines/1.6.0_35-b1 0-428.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/1.6.0_3 5-b10-428.jdk/Contents/Classes/charsets.jar:/Library/Java/JavaVirtualMachines/1. 6.0_35-b10-428.jdk/Contents/Classes/classes.jar:/Library/Java/JavaVirtualMachine s/1.6.0_35-b10-428.jdk/Contents/Classes/jsse.jar:/Library/Java/JavaVirtualMachin es/1.6.0_35-b10-428.jdk/Contents/Classes/ui.jar:/Library/Java/JavaVirtualMachine s/1.6.0_35-b10-428.jdk/Contents/Home/lib/ext/apple_provider.jar:/Library/Java/Ja vaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/lib/ext/dnsns.jar:/Library/ Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/lib/ext/localedata.j ar:/Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/lib/ext/ sunjce_provider.jar:/Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Conte nts/Home/lib/ext/sunpkcs11.jar:/Users/dmitry/IdeaProjects/smacker/target/classes :/Users/dmitry/IdeaProjects/smacker/lib/smack-3.2.1.jar:/Users/dmitry/IdeaProjec ts/smacker/lib/smackx-3.2.1.jar:/Applications/IntelliJ IDEA 11 CE.app/lib/idea_rt.jar” com.intellij.rt.execution.application.AppMain Main

Connection failed. No response from server.:

at org.jivesoftware.smack.PacketReader.startup(PacketReader.java:119)

at org.jivesoftware.smack.XMPPConnection.initConnection(XMPPConnection.java:568)

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

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

at SessionsHandler.openSession(SessionsHandler.java:62)

at Main.main(Main.java:16)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

and debugger info:

in:

<stream:stream to="xmpp.odnoklassniki.ru" xmlns="jabber:client" xmlns:stream="[http://etherx.jabber.org/streams](http://etherx.jabber.org/streams)" version="1.0">
<stream:stream to="odnoklassniki.ru" xmlns="jabber:client" xmlns:stream="[http://etherx.jabber.org/streams](http://etherx.jabber.org/streams)" version="1.0">

</stream:stream>

out:

<?xml version="1.0"?><stream:stream xmlns="jabber:client" xmlns:stream="[http://etherx.jabber.org/streams](http://etherx.jabber.org/streams)" from="odnoklassniki.ru" version="1.0" xml:lang="en">

<stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>X-ODKL-API</mechanism><mech anism>X-ODKL-BLOWFISH</mechanism><mechanism>PLAIN</mechanism></mechanisms><auth xmlns='[http://jabber.org/features/iq-auth'/](http://jabber.org/features/iq-auth'/)></stream:features>
<?xml version="1.0"?><stream:stream xmlns="jabber:client" xmlns:stream="[http://etherx.jabber.org/streams](http://etherx.jabber.org/streams)" from="odnoklassniki.ru" version="1.0" xml:lang="en">

<stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>X-ODKL-API</mechanism><mech anism>X-ODKL-BLOWFISH</mechanism><mechanism>PLAIN</mechanism></mechanisms><auth xmlns='[http://jabber.org/features/iq-auth'/](http://jabber.org/features/iq-auth'/)></stream:features>

please help me.

ps:

telnet:

dmitry@pro:~$ telnet xmpp.odnoklassniki.ru 5222

Trying 217.20.145.69…

Connected to xmpp.odnoklassniki.ru.

Escape character is ‘^]’.

and link on stackOverflow: http://stackoverflow.com/questions/13290499/could-not-connect-to-the-xmpp-server -via-smack-xmpp-in-java