powered by Jive Software

How to catch a StreamError?

It appears to me that StreamError is meant to

percolate up to the XmppConnection constructor,

but I am not too sure about that. How is

application code supposed to catch StreamError



sorry, posted too soon. looks like ConnectionListener is how its done.

Please explain how you used ConectionListener. I am currently getting the same error, yet the message is successfully sent to the other client. I need to find a fix for it. This is what I’'m getting:

stream:error (conflict)

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:315)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:63)


A connection listener is just another listener you can add, to listen out for Connection specific events, such as Connection Closed and Connection Closed on Error.

So you can implement the ConnectionListener interface

public class ConnectionClosedListener implements ConnectionListener {

public void connectionClosed() {

// perfom some custom logic in here


public void connectionClosedOnError(Exception e) {

// perform some custom logic in here




The you just add this class to your XMPPConnection

conn.addConnectionListener(new ConnectionClosedListener());


Now when the connection is either closed or closed due to an error the listener will fire and perform whatever logic you put in it