powered by Jive Software

Stream:error (host-unknown) when trying to connect

This must be a very basic problem. I’m using Smack for the first time and started with making a connection to the server. Here is the code:

ConnectionConfiguration config = new ConnectionConfiguration(“my.server.com”, 5222);
XMPPConnection connection = new XMPPConnection(config);
connection.login("user@domain.com", “passwd”);
catch(Exception e){

It returned with error:

stream:error (host-unknown)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:306)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)
Connection failed. No response from server.:
at org.jivesoftware.smack.PacketReader.startup(PacketReader.java:164)
at org.jivesoftware.smack.XMPPConnection.initConnection(XMPPConnection.java:945)
at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection. java:904)
at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1415)
at oracle.beehive.sample.xmppclient.XMPPClient.main(XMPPClient.java:20)

My server is running fine because I can connect it with Pidgin. Can someone please help? Thanks a lot!

It looks fine to me, but it seems it can’t resolve the hostname of your my.server.com. Try feeding it the IP as well to see if that makes a difference:

ConnectionConfiguration config = new ConnectionConfiguration(“”, 5222, “my.server.com”, ProxyInfo.forDefaultProxy());

where is the IP of your XMPP server.