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

拥有回忆 提交于 2019-11-28 20:57:51

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!