XMPP Connection logout?

Hi everyone,

I’m using Smack for connectiong to Openfire server. Following code logs me in:

ConnectionConfiguration confConn = new ConnectionConfiguration(serverAddress, serverPort, serviceName);

connection = new XMPPConnection(confConn);



If I quit the application withoul logging out, I am disconnected (connection.disconnect() is executed), but I’m still logged in.

When I start the app, the code makes new connection, connects me, and tries to log me with the same account parameters.

I read in this forum that this is not allowed, i.e. stream:error (conflict) is thrown.

The Openfire Resource Policy is set to: Always kick - If there is a resource conflict, immediately kick the other resource.

Can some one tell me how can I logout???

Thanks in advance…

Kindly regards,


Send an “unavaiable” Presence packet before calling XMPPConnection.disconnect().

Presence offlinePres = new Presence(Presence.Type.unavailable, "", 1, Presence.Mode.away);

Thanks Sabine for your post.

Now, I get the desired status (offline), but my app still returns:

stream:error (conflict);

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);

I read that this happens due to multiple logins with same resource. Have anyone got an idea how can I fix this???

  1. Also, the contact comes logged in and logged out all the time (repeating the action). What about this one???

  2. I’m curious why reconnectionSuccessful() is executed before connectionClosed() within the ConnectionListener…

Thanks in advance.