title: java.lang.NoClassDefFoundError: Could not initialize class com.datastax.driver.core.Cluster
body: <p>I have a maven project A</p>
  
  <p>pom.xml for the project A : </p>
  
  <pre><code>&lt;dependencies&gt;
         &lt;dependency&gt; 
              &lt;groupId&gt;com.app.cops&lt;/groupId&gt;
              &lt;artifactId&gt;cassandra-logging&lt;/artifactId&gt;
              &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>pom.xml of the project cassandra-logging:</p>
  
  <pre><code>&lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.netty&lt;/groupId&gt;
              &lt;artifactId&gt;netty&lt;/artifactId&gt;
              &lt;version&gt;3.9.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.codahale.metrics&lt;/groupId&gt;
              &lt;artifactId&gt;metrics-core&lt;/artifactId&gt;
              &lt;version&gt;3.0.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;version&gt;1.7.5&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.datastax.cassandra&lt;/groupId&gt;
              &lt;artifactId&gt;cassandra-driver-core&lt;/artifactId&gt;
              &lt;version&gt;3.0.0&lt;/version&gt;
          &lt;/dependency&gt;   
          &lt;dependency&gt;
              &lt;groupId&gt;com.datastax.cassandra&lt;/groupId&gt;
              &lt;artifactId&gt;cassandra-driver-mapping&lt;/artifactId&gt;
              &lt;version&gt;3.0.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.guava&lt;/groupId&gt;
              &lt;artifactId&gt;guava&lt;/artifactId&gt;
              &lt;version&gt;19.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
              &lt;artifactId&gt;gson&lt;/artifactId&gt;
              &lt;version&gt;2.3.1&lt;/version&gt;
          &lt;/dependency&gt;
    &lt;/dependencies&gt;
  </code></pre>
  
  <p>The cops-logging projecct has the following code :</p>
  
  <pre><code>CassandraCopsComponentLogger.instance = new CassandraCopsComponentLogger();
  
                  String hosts = CassandraClientUtil.getHost();
                  String localDC = CassandraClientUtil.getLocalDC();
                  Cluster cluster;
                  if (StringUtils.isNotEmpty(localDC))
                  {
                      cluster = Cluster.builder().addContactPoints(hosts.split(","))
                              .withCredentials(CassandraCopsComponentLogger.USER_NAME, CassandraCopsComponentLogger.AUTH_CODE)
                              .withQueryOptions(new QueryOptions().setConsistencyLevel(ConsistencyLevel.LOCAL_ONE))
                              .withLoadBalancingPolicy(new TokenAwarePolicy(DCAwareRoundRobinPolicy.builder().withLocalDc(localDC).build())).build();
                  }
                  else
                  {
                      cluster = Cluster.builder().addContactPoints(hosts.split(","))
                              .withCredentials(CassandraCopsComponentLogger.USER_NAME, CassandraCopsComponentLogger.AUTH_CODE)
                              .withQueryOptions(new QueryOptions().setConsistencyLevel(ConsistencyLevel.LOCAL_ONE)).build();
                  }
  
                  Session session = cluster.connect();
                  CassandraCopsComponentLogger.mappingManager = new MappingManager(session);
  </code></pre>
  
  <p>I keep on getting exception on the following line :</p>
  
  <pre><code>cluster = Cluster.builder().addContactPoints(hosts.split(","))
  </code></pre>
  
  <p>I have a unit test in cassandra-logging project which works fine with this code. But when I call the same code from project A I get the </p>
  
  <pre><code>java.lang.NoClassDefFoundError: Could not initialize class com.datastax.driver.core.Cluster
  </code></pre>