title: Android Client for OpenFire Server
body: <p>I am developing an android chat application which has to connect to the OpenFire Server running on my machine. I tried a lot of options but unable to connect even. Please help if any of you know about the same at the earliest possible. I am using smack.jar in my application. Here are the few lines from my code:</p>
  
  <pre><code>    String username = "test@inbasdpc06783";
      String password = "admin";
  
  
  
      // Create a connection
  //        ConnectionConfiguration connConfig =
  //                new ConnectionConfiguration(host, Integer.parseInt(port), service);
  
  
  
  
     ConnectionConfiguration connConfig = new ConnectionConfiguration("inbasdpc06783");
  
  
     connConfig.setCompressionEnabled(true);
     connConfig.setSASLAuthenticationEnabled(true);
  
  
  
      XMPPConnection connection = new XMPPConnection(connConfig);
  
      try {
          Log.d("XMPPClient", "[SettingsDialog] BEFORE Connected to " + connection.getHost());
          connection.connect();            
          Log.d("XMPPClient", "[SettingsDialog] AFTER Connected to connection.isConnected()&gt;&gt;&gt;" + connection.isConnected());            
      } catch (XMPPException ex) {
          Log.e("XMPPClient", "[SettingsDialog] Failed to connect to " + connection.getHost());
          Log.e("XMPPClient", ex.toString());
          xmppClient.setConnection(null);
      }
  </code></pre>
  
  <p>I am getting the following error :</p>
  
  <pre><code>10-15 18:39:02.759: E/dalvikvm(17668): Could not find class 'javax.naming.directory.InitialDirContext', referenced from method org.jivesoftware.smack.util.DNSUtil.&lt;clinit&gt;
  10-15 18:39:02.800: E/AndroidRuntime(17668): FATAL EXCEPTION: main
  10-15 18:39:02.800: E/AndroidRuntime(17668): java.lang.ExceptionInInitializerError
  10-15 18:39:02.800: E/AndroidRuntime(17668):    at org.jivesoftware.smack.ConnectionConfiguration.&lt;init&gt;(ConnectionConfiguration.java:81)
  10-15 18:39:02.800: E/AndroidRuntime(17668):    at org.apache.android.xmpp.SettingsDialog.onClick(SettingsDialog.java:51)
  10-15 18:39:02.800: E/AndroidRuntime(17668):    at android.view.View.performClick(View.java:3538)
  10-15 18:39:02.800: E/AndroidRuntime(17668):    at android.view.View$PerformClick.run(View.java:14330)
  10-15 18:39:02.800: E/AndroidRuntime(17668):    at android.os.Handler.handleCallback(Handler.java:608)
  10-15 18:39:02.800: E/AndroidRuntime(17668):    at android.os.Handler.dispatchMessage(Handler.java:92)
  10-15 18:39:02.800: E/AndroidRuntime(17668):    at android.os.Looper.loop(Looper.java:156)
  10-15 18:39:02.800: E/AndroidRuntime(17668):    at android.app.ActivityThread.main(ActivityThread.java:4987)
  10-15 18:39:02.800: E/AndroidRuntime(17668):    at java.lang.reflect.Method.invokeNative(Native Method)
  10-15 18:39:02.800: E/AndroidRuntime(17668):    at java.lang.reflect.Method.invoke(Method.java:511)
  10-15 18:39:02.800: E/AndroidRuntime(17668):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
  10-15 18:39:02.800: E/AndroidRuntime(17668):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
  10-15 18:39:02.800: E/AndroidRuntime(17668):    at dalvik.system.NativeStart.main(Native Method)
  10-15 18:39:02.800: E/AndroidRuntime(17668): Caused by: java.lang.NoClassDefFoundError: javax.naming.directory.InitialDirContext
  10-15 18:39:02.800: E/AndroidRuntime(17668):    at org.jivesoftware.smack.util.DNSUtil.&lt;clinit&gt;(DNSUtil.java:47)
  10-15 18:39:02.800: E/AndroidRuntime(17668):    ... 13 more
  </code></pre>