Exception is thrown in OfflineMessageManager.getMessages when large number of offline messages is retrieved from the server

I have simple test case that connects to the server and tries read a large number of messages. The treshhold seems to be somewhere between 12K - 15K messages. If there is 12K or fewere messages in the jiveOffline table, the program works fine, but if I cross the threshold, I get the following stack trace:

No response from server.:

at org.jivesoftware.smackx.OfflineMessageManager.getMessages(OfflineMessageManager .java:208)

at OfflineTest.main(OfflineTest.java:30)

Here is the simple code I run to test OfflineMessageManager:

import java.util.Iterator;

import org.jivesoftware.smack.ConnectionConfiguration;

import org.jivesoftware.smack.XMPPConnection;

import org.jivesoftware.smack.XMPPException;

import org.jivesoftware.smack.packet.Message;

import org.jivesoftware.smackx.OfflineMessageManager;

public class OfflineTest {

public static void main(String[] args) {

try {

ConnectionConfiguration cc = new ConnectionConfiguration(“localhost”,

5222);

cc.setSASLAuthenticationEnabled(false);

XMPPConnection con = new XMPPConnection(cc);

con.connect();

con.login(“user”, “user”, “res”, false);

OfflineMessageManager omm = new OfflineMessageManager(con);

System.out.println(“There are " + omm.getMessageCount() + " offline messages”);

Iterator<Message> itr = omm.getMessages();

int i = 1;

while (itr.hasNext()) {

Message m = itr.next();

System.out.println(i+++ ": " + m.getBody());

}

} catch (XMPPException e) {

e.printStackTrace();

}

}

}

More tests results after looking into OfflineOfficeManager source code - that exception is thrown because of the timeout that is 5000 ms. So I bumped to 5 minutes, hoping it would allow to get around the problem, but I got still the same error, just 5 min later:

There are 15000 offline messages

packet reply timeout is 300000

Start getting messages at Thu Aug 30 12:55:29 EDT 2007

Error getting messages at Thu Aug 30 13:00:29 EDT 2007

No response from server.:

at org.jivesoftware.smackx.OfflineMessageManager.getMessages(OfflineMessageManager .java:208)

at OfflineTest.main(OfflineTest.java:48)