3

Our application uses EmbeddedCassandraService for unit testing. We're using Cassandra 3.11 and the java driver from Datastax 3.3.0.

EmbeddedCassandraService cassandraService = new EmbeddedCassandraService();
cassandraService.start();

We are able to use embedded cassandra perfectly fine when testing our domain classes. However, when using it with our API tests (which have a different set of dependencies) it throws the following exception:

Caused by: org.apache.cassandra.exceptions.InvalidRequestException: unconfigured table schema_keyspaces
    at org.apache.cassandra.thrift.ThriftValidation.validateColumnFamily(ThriftValidation.java:115)
    at org.apache.cassandra.cql3.statements.SelectStatement$RawStatement.prepare(SelectStatement.java:920)
    at org.apache.cassandra.cql3.statements.SelectStatement$RawStatement.prepare(SelectStatement.java:915)
    at org.apache.cassandra.cql3.QueryProcessor.getStatement(QueryProcessor.java:557)
    at org.apache.cassandra.cql3.QueryProcessor.parseStatement(QueryProcessor.java:253)
    at org.apache.cassandra.cql3.QueryProcessor.executeOnceInternal(QueryProcessor.java:354)
    at org.apache.cassandra.schema.LegacySchemaMigrator.query(LegacySchemaMigrator.java:1044)
    at org.apache.cassandra.schema.LegacySchemaMigrator.readSchema(LegacySchemaMigrator.java:173)
    at org.apache.cassandra.schema.LegacySchemaMigrator.migrate(LegacySchemaMigrator.java:77)
    at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:256)
    at org.apache.cassandra.service.CassandraDaemon.init(CassandraDaemon.java:503)
    at org.apache.cassandra.service.EmbeddedCassandraService.start(EmbeddedCassandraService.java:51)
    at com.company.project.schema.cassandra.config.EmbeddedCassandraConfiguration.session(EmbeddedCassandraConfiguration.java:24)

We're not sure why one module works but the other does not as the cassandra dependencies are identical. Additionally, neither module depends on spring-data-cassandra and both modules are using datastax's 3.3.0 driver. I'm confused as to why the issue occurs in the LegacySchemaMigrator as this EmbeddedCassandraService should be creating the system tables from scratch every time it is started (and there shouldn't be any schema to, well, migrate). Does anyone have any insight as to what may be causing this issue?

cscan
  • 3,684
  • 9
  • 45
  • 83

1 Answers1

1

The issue was actually that the EmbeddedCassandraService was being started twice.

cscan
  • 3,684
  • 9
  • 45
  • 83