Reputation: 677
Getting these errors in logcat:
06-26 02:34:08.352: W/System.err(1261): java.security.KeyStoreException: java.security.NoSuchAlgorithmException: KeyStore jks implementation not found 06-26 02:34:08.352: W/System.err(1261): at java.security.KeyStore.getInstance(KeyStore.java:119) 06-26 02:34:08.352: W/System.err(1261): at org.jivesoftware.smack.ServerTrustManager.(ServerTrustManager.java:71) 06-26 02:34:08.352: W/System.err(1261): at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:858) 06-26 02:34:08.352: W/System.err(1261): at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:250) 06-26 02:34:08.352: W/System.err(1261): at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:46) 06-26 02:34:08.362: W/System.err(1261): at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:72) 06-26 02:34:08.362: W/System.err(1261): Caused by: java.security.NoSuchAlgorithmException: KeyStore jks implementation not found 06-26 02:34:08.362: W/System.err(1261): at org.apache.harmony.security.fortress.Engine.notFound(Engine.java:177) 06-26 02:34:08.362: W/System.err(1261): at org.apache.harmony.security.fortress.Engine.getInstance(Engine.java:151) 06-26 02:34:08.362: W/System.err(1261): at java.security.KeyStore.getInstance(KeyStore.java:116) 06-26 02:34:08.362: W/System.err(1261): ... 5 more
06-26 02:34:09.802: W/System.err(1261): SASL authentication failed using mechanism DIGEST-MD5: 06-26 02:34:09.802: W/System.err(1261): at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:341) 06-26 02:34:09.802: W/System.err(1261): at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:242) 06-26 02:34:09.802: W/System.err(1261): at org.jivesoftware.smack.Connection.login(Connection.java:371) 06-26 02:34:09.802: W/System.err(1261): at com.example.contactupdater.MainActivity$MainActivity2.login(MainActivity.java:358) 06-26 02:34:09.802: W/System.err(1261): at com.example.contactupdater.MainActivity$MainActivity2.login(MainActivity.java:347) 06-26 02:34:09.802: W/System.err(1261): at com.example.contactupdater.MainActivity$1.run(MainActivity.java:320)
Upvotes: 1
Views: 1017
Reputation: 677
Here is the answer for this problem...
AndroidConnectionConfiguration config = new AndroidConnectionConfiguration(server,
port);
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);
}
Upvotes: 2