3对XMPP聊天应用程序

3对XMPP聊天应用程序

本文介绍了在使用抛出:NoSuchAlgorithmException aSmack 0.8.3对XMPP聊天应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经包括logcat的输出。请帮我解决这个问题。


here is the logcat message iam getting now after adding ur code..

08-09 11:35:34.469: WARN/System.err(1733): java.lang.NullPointerException
08-09 11:35:34.469: WARN/System.err(1733):     at java.io.File.fixSlashes(File.java:185)
08-09 11:35:34.469: WARN/System.err(1733):     at java.io.File.<init>(File.java:134)
08-09 11:35:34.469: WARN/System.err(1733):     at java.io.FileInputStream.<init>(FileInputStream.java:105)
08-09 11:35:34.469: WARN/System.err(1733):     at org.jivesoftware.smack.ServerTrustManager.<init>(ServerTrustManager.java:71)
08-09 11:35:34.469: WARN/System.err(1733):     at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:871)
08-09 11:35:34.469: WARN/System.err(1733):     at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:221)
08-09 11:35:34.469: WARN/System.err(1733):     at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
08-09 11:35:34.469: WARN/System.err(1733):     at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)


Its not referring any line in my code...

08-09 11:57:32.126: W/BackupManagerService(868): dataChanged but no participant pkg='com.android.providers.settings' uid=1001
08-09 11:57:32.147: W/NetworkManagementSocketTagger(868): setKernelCountSet(10012, 0) failed with errno -2
08-09 11:57:32.198: W/System.err(1497): java.lang.NullPointerException
08-09 11:57:32.198: W/System.err(1497):     at java.io.File.fixSlashes(File.java:185)
08-09 11:57:32.198: W/System.err(1497):     at java.io.File.<init>(File.java:134)
08-09 11:57:32.198: W/System.err(1497):     at java.io.FileInputStream.<init>(FileInputStream.java:105)
08-09 11:57:32.198: W/System.err(1497):     at org.jivesoftware.smack.ServerTrustManager.<init>(ServerTrustManager.java:71)
08-09 11:57:32.198: W/System.err(1497):     at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:871)
08-09 11:57:32.198: W/System.err(1497):     at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:221)
08-09 11:57:32.198: W/System.err(1497):     at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
08-09 11:57:32.198: W/System.err(1497):     at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
解决方案

This is how I handle it

ConnectionConfiguration config = new ConnectionConfiguration("your_server", port_no);
config.setSASLAuthenticationEnabled(true);
config.setCompressionEnabled(true);
config.setSecurityMode(SecurityMode.enabled);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    config.setTruststoreType("AndroidCAStore");
    config.setTruststorePassword(null);
    config.setTruststorePath(null);
} else {
    config.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";
    config.setTruststorePath(path);
}

这篇关于在使用抛出:NoSuchAlgorithmException aSmack 0.8.3对XMPP聊天应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 20:29