title: Cassandra CQL JDBC Exception : java.lang.ClassNotFoundException: org.apache.thrift.TEnum
body: <p>I have tried with the following code to connect CASSANDRA Database on my local system.</p>
  
  <pre><code>package com.prm.cassandra;
  
  import java.sql.Connection;
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  import java.sql.ResultSetMetaData;
  
  public class CassandraUserManager {
  public static void connectToCassandra(){
      DataBaseConnection dbCon = new DataBaseConnection();
      Connection con = null;
      PreparedStatement pstmt = null;
      ResultSet rs = null;
      try{
          con = dbCon.getConnection();
  
          String query = "SELECT * from users";
          pstmt = con.prepareStatement(query);
          rs = pstmt.executeQuery();
          System.out.println("The Details are printed below.");
          ResultSetMetaData rmd = rs.getMetaData();
          while(rs.next()){
              for(int i=0; i&lt;rmd.getColumnCount(); i++)
              System.out.print("  "+rs.getString(i));
          }
      }catch(Exception ex){
          ex.printStackTrace();
      }finally{
          dbCon.closeResources(con, pstmt, rs);
      }
  }
  }
  </code></pre>
  
  <p>And used the following lines to get the database connection</p>
  
  <pre><code>Class.forName("org.apache.cassandra.cql.jdbc.CassandraDriver");
  Connection con = DriverManager.getConnection("jdbc:cassandra://127.0.0.1:9160/demo");
  </code></pre>
  
  <p>But got the below runtime exception.</p>
  
  <pre><code>SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
  SLF4J: Defaulting to no-operation (NOP) logger implementation
  SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
  Jul 16, 2013 1:08:39 PM org.apache.catalina.core.StandardWrapperValve invoke
  SEVERE: Servlet.service() for servlet connectCassandra threw exception
  java.lang.ClassNotFoundException: org.apache.thrift.TEnum
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
  at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1819)
  at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1327)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
  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(DriverManager.java:582)
  at java.sql.DriverManager.getConnection(DriverManager.java:207)
  at com.prm.cassandra.DataBaseConnection.getConnection(DataBaseConnection.java:14)
  at com.prm.cassandra.CassandraUserManager.connectToCassandra(CassandraUserManager.java:15)
  at com.prm.cassandra.CassandraServlet.doGet(CassandraServlet.java:28)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
  at java.lang.Thread.run(Thread.java:680)
  </code></pre>
  
  <p>I have used the below mentioned jars as suggested by <a href="https://code.google.com/a/apache-extras.org/p/cassandra-jdbc/wiki/HowToBuild" rel="nofollow">CASSANDRA-JDBC Example</a></p>
  
  <pre><code>apache-cassandra-clientutil-1.2.6.jar
  apache-cassandra-thrift-1.2.6.jar
  cassandra-jdbc-1.2.5.jar
  </code></pre>
  
  <p>and the below one for logging</p>
  
  <pre><code>slf4j-api-1.6.1.jar
  </code></pre>
  
  <p>Please help me out in resolving this. Waiting for an useful answer. Thanks in advance.</p>