I have Openfire 3.9.3 here. I have this Java code:
public class Main {
public static void main(String[] args) throws IOException, SmackException, XMPPException, InterruptedException {
ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(“http://localhost”, 5222);
XMPPConnection connection = new XMPPTCPConnection(connectionConfiguration);
connection.connect();
connection.login(“mhamdy”, “password”);
Presence presence = new Presence(Presence.Type.unavailable);
presence.setStatus(“Coding”);
connection.sendPacket(presence);
Thread.sleep(1000);
}
}
It’s raising this exception (at connection.connect() line ):
Exception in thread “main” org.jivesoftware.smack.SmackException$ConnectionException
at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPC onnection.java:436)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection. java:811)
at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:396)
at Main.main(Main.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
What I’m doing wrong?. I tried just “localhost” and “http://localhost” and “127.0.0.1” and others. The server is running and I browse the admin just fine.