title: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/thrift/TEnum
body: <p>I have tried with the following code to connect CASSANDRA Database on my local system.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.sql.Statement;
  
  public class DBConnect {
  
  
  public static void main(String[] args) throws Exception{
  
  Connection con = null;
  try {
  Class.forName("org.apache.cassandra.cql.jdbc.CassandraDriver");
  con = DriverManager.getConnection("jdbc:cassandra://localhost:9160/mykeyspace");
  
     String query = "select * from users";
  
     Statement stmt = con.createStatement();
     ResultSet result = stmt.executeQuery(query);
  
     while (result.next()) {
      System.out.println(result.getString("user_id"));
      System.out.println(result.getString("fname"));
      System.out.println(result.getString("lname"));
     }
  
    } catch (ClassNotFoundException e) {
     e.printStackTrace();
    } catch (SQLException e) {
     e.printStackTrace();
    } finally {
     if (con != null) {
      try {
       con.close();
      } catch (SQLException e) {
       e.printStackTrace();
      }
      con = null;
     }
    }
  
   }}
  </code></pre>
  
  <p>and here is a error message which i recieve.</p>
  
  <pre><code> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/thrift/TEnum
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClass(Unknown Source)
  at java.security.SecureClassLoader.defineClass(Unknown Source)
  at java.net.URLClassLoader.defineClass(Unknown Source)
  at java.net.URLClassLoader.access$100(Unknown Source)
  at java.net.URLClassLoader$1.run(Unknown Source)
  at java.net.URLClassLoader$1.run(Unknown Source)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at org.apache.cassandra.cql.jdbc.Utils.&lt;clinit&gt;(Utils.java:62)
  at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:85)
  at java.sql.DriverManager.getConnection(Unknown Source)
  at java.sql.DriverManager.getConnection(Unknown Source)
  at DBConnect.main(DBConnect.java:15)
  Caused by: java.lang.ClassNotFoundException: org.apache.thrift.TEnum
  at java.net.URLClassLoader$1.run(Unknown Source)
  at java.net.URLClassLoader$1.run(Unknown Source)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  ... 17 more
  </code></pre>
  
  <p>I have added following Jar files.</p>
  
  <ol>
  <li>apache-cassandra-thrift-1.2.5.jar </li>
  <li>cassandra-jdbc-1.2.5.jar</li>
  <li>slf4j-api-1.7.5.jar </li>
  <li>slf4j-jdk14-1.7.5.jar</li>
  </ol>
  
  <p>Please help me to solve this issue.</p>
  
  <p>Thanks</p>