The problem of getPresence method

I wrote another class to search the users’’ presence of spark with smack API.

I’'m sure the user is online while getPresence method return me unavailable,why?

and some error messages also printed:

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)

who can tell me why?

Below is my code

config = new ConnectionConfiguration(serverIP, 5222);

config.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled);

config.setDebuggerEnabled(false);

config.setExpiredCertificatesCheckEnabled(false);

config.setNotMatchingDomainCheckEnabled(false);

config.setSelfSignedCertificateEnabled(true);

config.setVerifyRootCAEnabled(false);

XMPPConnection con = new XMPPConnection(config);

//XMPPConnection con = new XMPPConnection(serverIP);

System.out.println("get connection ");

try{

con.connect();

con.login(“admin”, “admin”);

}

catch(XMPPException e){

System.out.println(“xmp Excetion:”+e.toString());

}

Roster roster = con.getRoster();

Presence status=roster.getPresence(rdStr);

System.out.println(roster.getPresence(“fantacy@asterisk”));

con.disconnect();

Thanks.

Message was edited by: love_peace