I'm new in ejabberd and I'm trying to create a java program only to do some test with the service ejabberd, but always have the same response from the server.
The server is running because I can try with two pidgin clients.
I'm trying to follow the samples of http://xmpp.org/extensions/xep-0016.html
And about the code
ConnectionConfiguration cc = new ConnectionConfiguration("ip_server", 5222, "domain_defined_in_cfg");
// In ejabberd.cfg -> {hosts, ['domain_defined_in_cfg']}
cc.setDebuggerEnabled(true);
cc.setSASLAuthenticationEnabled(true);
XMPPConnection con = new XMPPConnection(cc);
System.setProperty("smack.debugEnabled", "true");
XMPPConnection.DEBUG_ENABLED = true;
try {
SASLAuthentication.supportSASLMechanism("PLAIN", 0);
con.connect();
//This line returns
/*
No response from the server.:
at org.jivesoftware.smack.SASLAuthentication.bindResourceAndEstablishSession(SASLAuthentication.java:430)
at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:331)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:395)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:349)
*/
//con.login("user_admin", "password_user_admin");
Packet packet = new Packet() {
@Override
public String toXML() {
//Sample of iq request
StringBuilder sb = new StringBuilder("<iq type=\"get\" to=\"ip_server\">");
sb.append("<query xmlns=\"jabber:iq:version\"/>");
sb.append("</iq>");
return sb.toString();
}
};
con.sendPacket(packet);
} catch (XMPPException xe) {
xe.printStackTrace();
return;
}
When I send the iq request of the code or another like this
<iq from='[email protected]' type='get' id='getlist1'>
<query xmlns='jabber:iq:privacy'/>
</iq>
to the server, I always received the same response
<iq id="getlist1" from="domain.com" type="error">
<error code="503" type="CANCEL">
<service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
Just only try to follow the example 1 of http://xmpp.org/extensions/xep-0016.html
The login could be a problem, but anyway, I'm more interesting in why can't I send messages to the server. Or, how can I send messages in another way? (I checked with putty too)
Any ideas?
Thanks!
From the information you are sharing, it looks like you may not actually be successfully authentified on ejabberd:
Maybe the authentication backend you configured for ejabberd does not support SASL.
You should try to disable SASL authentication:
and then uncomment your login call.