Smack 4.1: Exception reloading roster

1.7k views Asked by At

I keep getting the same error message over and over again. At first I thought it was an issue with timeout so i set .setPacketReplyTimeout(15000);still it just happens to wait for longer then shows the same error message. On deeper findings, I found it is because it was expecting something from the server (What could that be?). Also I found, you can setRosterLoadedAtLogin(false)but it's not clear how to, as XMPPTCPConnectionConfigurationdoes not have that method i.e. configBuilder.setRosterLoadedAtLogin(false). Here is a dump. I'll like a good explanation of what's going on and how to fix it. Thank you

06-09 01:04:25.122    3192-3214/com.company.smacklearn E/Roster﹕ Exception reloading roster
    org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). Used filter: IQReplyFilter: iqAndIdFilter (AndFilter: (OrFilter: (IQTypeFilter: type=error, IQTypeFilter: type=result), StanzaIdFilter: id=AUQtk-7)), : fromFilter (OrFilter: (FromMatchesFilter (full): null, FromMatchesFilter (bare): [email protected], FromMatchesFilter (full): myserver.com)).
            at org.jivesoftware.smack.AbstractXMPPConnection$6.run(AbstractXMPPConnection.java:1438)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)
3

There are 3 answers

0
Lait On

Maybe I found the real reason that is my correct operation in the project of the code below:

try {
        ConnectionConfiguration config = new ConnectionConfiguration(OF_HOST, OF_PORT);
        config.setReconnectionAllowed(true);
        config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
        config.setSendPresence(true);
        config.setDebuggerEnabled(true);
        config.setCompressionEnabled(false);

        SASLAuthentication.supportSASLMechanism("PLAIN", 0);

        connection = new XMPPTCPConnection(config);

        Log.i("connection", connection.toString());
        if (connection.isConnected()) {
            connection.disconnect();
        }
        connection.connect();

        return connection;
    } catch (Exception e) {
        e.printStackTrace();
    }
0
Lait On

here is my dump:

07-07 18:06:31.469    7218-7260/cc.lait.d2.smack_demo E/Roster﹕ Exception reloading roster
    org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). Used filter: IQReplyFilter: iqAndIdFilter (AndFilter: (OrFilter: (IQTypeFilter: type=error, IQTypeFilter: type=result), StanzaIdFilter: id=s3Dmr-7)), : fromFilter (OrFilter: (FromMatchesFilter (full): null, FromMatchesFilter (bare): e02b65a7bdc0f12662ac0d617e7eb3d1@iz23qr9ipxwz, FromMatchesFilter (full): iz23qr9ipxwz)).
            at org.jivesoftware.smack.AbstractXMPPConnection$6.run(AbstractXMPPConnection.java:1438)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)

I also started using smack4.1 in recent days, met a similar mistake with you, carried out tests found because I use con.disconnect();.in smack 4.1 ,we can’t find setRosterLoadedAtLogin(),so I think that the time we close connect is wrong.

0
Lait On
@Override
    protected void onDestroy() {
        super.onDestroy();
        con.disconnect();
    }

I find that if we use con.disconnect(); in onDestroy() or onPause(),it will not get the error Exception reloading roster