AnsweredAssumed Answered

i am using openfire 3.9.3 and i have my database as mysql. i am not able to retrieve any information for offlinemessage as well as for roster?

Question asked by naveen on Jan 4, 2016

will it retrieval of data work normally or should i use different way to get the data.

i have offline messages for use but i am not able to get any..

 

DomainBareJid jid = JidCreate.domainBareFrom("babu-pc");
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setXmppDomain(jid)
  .setHost("localhost")
  .setPort(5222)
  .setSecurityMode(SecurityMode.disabled)
   .setDebuggerEnabled(true)
  .setSendPresence(false)
  .build();

 

 

AbstractXMPPConnection connection = new XMPPTCPConnection(config);
connection.connect();
connection.login("babu@babu-pc", "12345");
connection.sendStanza(new Presence(Presence.Type.unavailable));
ProviderManager.addExtensionProvider("x","jabber:x:delay", new DelayInformationProvider());
ServiceDiscoveryManager manager =  ServiceDiscoveryManager.getInstanceFor(connection);

        DiscoverInfo info = manager.discoverInfo(null,"http://jabber.org/protocol/offline");   //error at this line

           Form extendedInfo = Form.getFormFrom(info);

           if (extendedInfo != null) {

               String value = extendedInfo.getField("number_of_messages").getValues().get(1);

           }

}

error:

09:50:59 AM RECV (0): <iq type="error" id="xYvrT-9" to="ab25f459@babu-pc/ab25f459"><query xmlns="http://jabber.org/protocol/disco#info" node="http://jabber.org/protocol/offline"/><error code="404" type="cancel"><item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

Exception in thread "main" org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: item-not-found - cancel

at org.jivesoftware.smack.XMPPException$XMPPErrorException.ifHasErrorThenThrow(XMP PException.java:135)

  at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:2 32)

  at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:2 07)

  at org.jivesoftware.smackx.disco.ServiceDiscoveryManager.discoverInfo(ServiceDisco veryManager.java:539)

Outcomes