Cannot locate cassandra.yaml

638 views
Skip to first unread message

Tim Delesio

unread,
Nov 12, 2013, 11:15:01 AM11/12/13
to cassandra-...@googlegroups.com
I've built a test using cassandra-unit-spring using version 1.2.0.1.  I have setup a simple test this is similar to the one you have posted in git.

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({ CassandraUnitTestExecutionListener.class })
@CassandraDataSet(value = { "simple.cql" })
@EmbeddedCassandra
public class CassandraUnitTester extends AbstractTest {

    @Test
    public void should_have_started_and_execute_cql_script() throws Exception {
        Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1")
                .withPort(9142).build();
        Session session = cluster.connect("cassandra_unit_keyspace");

        ResultSet result = session
                .execute("select * from mytable WHERE id='myKey01'");
        Assert.assertEquals(result.iterator().next().getString("value"), "myValue01");

    }

}

When I execute this test I get the following error:

2013-11-12 11:07:46,831 ERROR (org.apache.cassandra.config.DatabaseDescriptor:495) - Fatal configuration error
org.apache.cassandra.exceptions.ConfigurationException: Cannot locate cassandra.yaml
    at org.apache.cassandra.config.DatabaseDescriptor.getStorageConfigURL(DatabaseDescriptor.java:112)
    at org.apache.cassandra.config.DatabaseDescriptor.loadYaml(DatabaseDescriptor.java:129)
    at org.apache.cassandra.config.DatabaseDescriptor.<clinit>(DatabaseDescriptor.java:121)
    at org.cassandraunit.utils.EmbeddedCassandraServerHelper.dropKeyspaces(EmbeddedCassandraServerHelper.java:140)

I even tried to manualyl set the cu_cassandra.yaml file in the EmbeddedCassandra via:

@EmbeddedCassandra(configuration="cu-cassandra.yaml", clusterName = "Test Cluster", host = "127.0.0.1", port = 9142)

This also generates the same error.  What am I doing wrong?  Here is my pom.xml dependency list as well:

<dependency>
                <groupId>org.hectorclient</groupId>
                <artifactId>hector-core</artifactId>
                <version>1.1-4</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>commons-lang</groupId>
                        <artifactId>commons-lang</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.cassandra</groupId>
                <artifactId>cassandra-all</artifactId>
                <version>1.2.0</version>
            </dependency>
            <dependency>
                <groupId>org.cassandraunit</groupId>
                <artifactId>cassandra-unit</artifactId>
                <version>1.2.0.1</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.cassandraunit</groupId>
                <artifactId>cassandra-unit-spring</artifactId>
                <version>1.2.0.1</version>
            </dependency>
        </dependencies>
        <dependency>
            <groupId>com.datastax.cassandra</groupId>
            <artifactId>cassandra-driver-core</artifactId>
            <version>1.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.codehaus.jackson</groupId>
                    <artifactId>jackson-core-asl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

Tim Delesio

unread,
Nov 12, 2013, 1:22:26 PM11/12/13
to cassandra-...@googlegroups.com
I figured out the problem.  The maven dependencies need to be set in the same project as the project using it and not in a parent project.  Once I moved it down a level, it started to work.

Jérémy Sevellec

unread,
Nov 12, 2013, 1:43:18 PM11/12/13
to cassandra-...@googlegroups.com
Ok cool, good to hear that you solve your problem

Regards
--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes cassandra-unit-users.
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse cassandra-unit-u...@googlegroups.com.
Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .
Reply all
Reply to author
Forward
0 new messages