Smack “No Response From Server”. Not sure why am i getting this error

前端 未结 2 1171
北海茫月
北海茫月 2020-12-14 13:43

I have an openfire server setted up on my local machine. I am trying to connect this server, but getting \"No response from server\" error. Not sure why?

I have spar

相关标签:
2条回答
  • 2020-12-14 13:51

    I have increased the reply timeout and it worked like charm.

    SmackConfiguration.setPacketReplyTimeout(10000);
    

    though not sure why I need to do so when the server is installed on the same machine.

    0 讨论(0)
  • 2020-12-14 14:00

    Did you notice the error:

    7-30 01:01:02.835: W/System.err(424): java.security.KeyStoreException: KeyStore jks implementation not found
    07-30 01:01:02.835: W/System.err(424):  at java.security.KeyStore.getInstance(KeyStore.java:134)
    07-30 01:01:02.835: W/System.err(424):  at org.jivesoftware.smack.ServerTrustManager.<init>(ServerTrustManager.java:61)
    07-30 01:01:02.835: W/System.err(424):  at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:839)
    07-30 01:01:02.835: W/System.err(424):  at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:268)
    07-30 01:01:02.835: W/System.err(424):  at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
    07-30 01:01:02.835: W/System.err(424):  at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:71)
    

    make sure to fix the truststore implementation! If you are using aSmack for example with

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        connectionConfiguration.setTruststoreType("AndroidCAStore");
        connectionConfiguration.setTruststorePassword(null);
        connectionConfiguration.setTruststorePath(null);
    } else {
        connectionConfiguration.setTruststoreType("BKS");
        String path = System.getProperty("javax.net.ssl.trustStore");
        if (path == null)
            path = System.getProperty("java.home") + File.separator + "etc"
                + File.separator + "security" + File.separator
                + "cacerts.bks";
        connectionConfiguration.setTruststorePath(path);
    }
    

    Source

    0 讨论(0)
提交回复
热议问题