Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8885591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:20:48+00:00 2026-06-14T21:20:48+00:00

I have a SessionDaoCassandraImpl class that reads data from Cassandra using Astyanax that I

  • 0

I have a SessionDaoCassandraImpl class that reads data from Cassandra using Astyanax that I would like to test with an embedded Cassandra server. CassandraUnit seems perfect to do so but I am running into an exception

ERROR - 2012-11-21 14:54:34,754 - AbstractCassandraDaemon.activate(370) | Exception encountered during startup
java.lang.NoSuchMethodError: com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap$Builder.maximumWeightedCapacity(I)Lcom/googlecode/concurrentlinkedhashmap/ConcurrentLinkedHashMap$Builder;
    at org.apache.cassandra.cache.ConcurrentLinkedHashCache.create(ConcurrentLinkedHashCache.java:70)

That exception is documented here but I fail to understand what I can do today to get around it.

Here are the pom dependencies I used:

  ...

      <dependency>
        <groupId>org.cassandraunit</groupId>
        <artifactId>cassandra-unit</artifactId>
        <version>1.1.1.1</version>  
        <!-- <version>1.1.0.1</version> --> 
        <!-- version 1.1.0.1 leads to java.lang.NoSuchMethodError:  
        com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap$Builder.maximumWeightedCapacity -->      
        <!-- <version>0.8.0.2.4</version> -->
        <!-- version 0.8.0.2.4 leads to ERROR - 2012-11-21 14:28:45,774 - 
        DatabaseDescriptor.loadYaml(479) | Fatal configuration error error -->      
        <scope>test</scope>
    </dependency>

  ...

I get the same exception whether I use 1.1.1.1 or 1.1.0.1.


Things I tried

I also tried to add an exclusion of the class responsible for the exception, re-adding the latest version 1.3.1 as another dependency:

  ...  

    <dependency>
        <groupId>org.cassandraunit</groupId>
        <artifactId>cassandra-unit</artifactId>
        <version>1.1.1.1</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>com.googlecode.concurrentlinkedhashmap</groupId>
                <artifactId>concurrentlinkedhashmap-lru</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.googlecode.concurrentlinkedhashmap</groupId>
        <artifactId>concurrentlinkedhashmap-lru</artifactId>
        <version>1.3.1</version>
    </dependency>
   ...

That didn’t help either with the exception.

Here is the code that generates the exception as soon as I run EmbeddedCassandraServerHelper.startEmbeddedCassandra();

import java.io.IOException;

import org.apache.cassandra.config.ConfigurationException;
import org.apache.thrift.transport.TTransportException;
import org.cassandraunit.DataLoader;
import org.cassandraunit.dataset.xml.ClassPathXmlDataSet;
import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
import org.junit.Before;
import org.junit.Test;

import com.netflix.astyanax.AstyanaxContext;
import com.netflix.astyanax.Keyspace;
import com.netflix.astyanax.connectionpool.NodeDiscoveryType;
import com.netflix.astyanax.connectionpool.impl.ConnectionPoolConfigurationImpl;
import com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor;
import com.netflix.astyanax.impl.AstyanaxConfigurationImpl;
import com.netflix.astyanax.thrift.ThriftFamilyFactory;

public class SessionDaoCassandraTestIT {

  private SessionDaoCassandraImpl sessionDao;

  @Before
  public void init() throws TTransportException, IOException,
  InterruptedException, ConfigurationException {

    EmbeddedCassandraServerHelper.startEmbeddedCassandra();
    final DataLoader dataLoader = new DataLoader("Test Cluster", "localhost:9171");
    dataLoader.load(new ClassPathXmlDataSet("cassandraDataSet.xml"));

    /* Doing this below instead of extending AbstractCassandraUnit4TestCase because
     * getDataSet.getKeySpace() returns a Hector keyspace but we want to use Astyanax
     * instead */

    /* Code below inspired from
     * http://pio-tech.blogspot.com/2012/07/unitintegration-testing-with-maven-and.html */
    final AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
    .forCluster("Test Cluster")
    .forKeyspace("sessiondata")
    .withAstyanaxConfiguration(
            new AstyanaxConfigurationImpl()
            .setDiscoveryType(NodeDiscoveryType.NONE))
            .withConnectionPoolConfiguration(
                    new ConnectionPoolConfigurationImpl("testConnectionPool")
                    .setPort(9171).setMaxConnsPerHost(1)
                    .setSeeds("localhost:9171"))
                    .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
                    .buildKeyspace(ThriftFamilyFactory.getInstance());
    context.start();
    final Keyspace keyspace = context.getEntity();
    sessionDao = new SessionDaoCassandraImpl(keyspace);

  }

  @Test
  public void shouldDisplayAccountFromSessionCreatedByDataLoader() {
    System.out.println(sessionDao.getSession("72b97796-b1b3-4220-ba03-ba7e9ecfe946").get().getAccount());
  }

}

Last, here is the beginning of my cassandraDataTest.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<keyspace xmlns="http://xml.dataset.cassandraunit.org">
    <name>sessiondata</name>
    <columnFamilies>
        <columnFamily>
            <name>session</name>
            <keyType>UTF8Type</keyType>
            <comparatorType>UTF8Type</comparatorType>
            <defaultColumnValueType>UTF8Type</defaultColumnValueType>
            <row>
                <key>72b97796-b1b3-4220-ba03-ba7e9ecfe946</key>
                <column>
                    <name>account</name>
                    <value>account</value>
                </column>
 ...      
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:20:50+00:00Added an answer on June 14, 2026 at 9:20 pm

    Turns out the astyanax library my project was using invoked an older version of cassandra than 1.1.1.
    Adding an exclusion in the pom solved my problem:

        <dependency>
            <groupId>com.netflix.astyanax</groupId>
            <artifactId>astyanax</artifactId>
            <version>1.0.4</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.cassandra</groupId>
                    <artifactId>cassandra-all</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a simple contact us XPage created. Have server side validation in place that
Have one Doubt In MVC Architecture we can able to pass data from Controller
Have data that has this kind of structure. Will be in ascending order by
Have data that has this kind of structure: $input = [ { animal: 'cat',
Have a look at the menu link Produkter on http://marckmann.se/ I would like to
Have a text box which get data for price. If someone enter something like
Have a xml data like <Items><Item><name>test1</name></Item><Item><name>test2</name></Item></Items> Looks like jaxb cannot unmashall this when defining
have an access database with a form that has multiple textboxes for production data.
have written this little class, which generates a UUID every time an object of
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.