Unable to start Embeded Cassandra cassandra-unit

1,103 views
Skip to first unread message

Vinod Jayachandran

unread,
Jun 7, 2016, 2:17:49 AM6/7/16
to cassandra-unit-users
I have added the below dependency to my project

<dependency>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit</artifactId>
<version>2.1.9.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

Now When I try to start Embedded cassandra, I get the below error

org.apache.cassandra.exceptions.ConfigurationException: Invalid yaml
	at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:120)
	at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:84)
	at org.apache.cassandra.config.DatabaseDescriptor.loadConfig(DatabaseDescriptor.java:161)
	at org.apache.cassandra.config.DatabaseDescriptor.<clinit>(DatabaseDescriptor.java:136)
	at org.cassandraunit.utils.EmbeddedCassandraServerHelper.mkdirs(EmbeddedCassandraServerHelper.java:333)
	at org.cassandraunit.utils.EmbeddedCassandraServerHelper.cleanupAndLeaveDirs(EmbeddedCassandraServerHelper.java:305)
	at org.cassandraunit.utils.EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.java:116)
	at org.cassandraunit.utils.EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.java:85)
	at org.cassandraunit.utils.EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.java:64)
	at org.cassandraunit.utils.EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.java:56)
	at org.cassandraunit.BaseCassandraUnit.before(BaseCassandraUnit.java:28)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:41)
	at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: Can't construct a java object for tag:yaml.org,2002:org.apache.cassandra.config.Config; exception=java.lang.reflect.InvocationTargetException
 in 'reader', line 10, column 1:
    cluster_name: 'Test Cluster'

Any thoughts ? Is it because of excluding guava dependency ?

Jérémy SEVELLEC

unread,
Jun 7, 2016, 3:14:06 AM6/7/16
to cassandra-...@googlegroups.com
Hi,

I don't think so.

Are you using your own cassandra.yaml file?


--
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 obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.



--
Jérémy

Vinod Jayachandran

unread,
Jun 7, 2016, 3:27:28 AM6/7/16
to cassandra-unit-users
No, I just copied the resources folder as is from https://github.com/jsevellec/cassandra-unit-examples

I believe it is referring to another-cassandra.yaml from resources folder

Jérémy SEVELLEC

unread,
Jun 7, 2016, 3:30:00 AM6/7/16
to cassandra-...@googlegroups.com
Ok.

So, It could be a wrong cassandra dependency which is not able to read the yaml file from cassandra-unit. Have you defined one?

--
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 obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.



--
Jérémy

Vinod Jayachandran

unread,
Jun 7, 2016, 4:16:10 AM6/7/16
to cassandra-unit-users
I haven't defined any. 

I did the following
1. Added dependency as stated above in pom.xml
3, Copied CQLScriptLoadTest.java and trying to run the test class.

How do i debug wrong cassandra dependency ?

On Tuesday, 7 June 2016 11:47:49 UTC+5:30, Vinod Jayachandran wrote:

Vinod Jayachandran

unread,
Jun 7, 2016, 4:36:05 AM6/7/16
to cassandra-unit-users
I believe https://github.com/jsevellec/cassandra-unit-examples is out dated and not the right example to refer. Can you point me to a working example with latest dependencies.

I cloned https://github.com/jsevellec/cassandra-unit-examples and updated the pom to latest versions. I did the following
1. Remove dependecies of cassandra unit and shaded as they are referring older versions. Other dependencies in the pom remain untouched.
2. Added latest pom cassandra-unit dependecies as below
<dependency>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit-spring</artifactId>
<version>2.2.2.1</version>
</dependency>

<dependency>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit</artifactId>
<version>2.1.9.2</version>
<scope>test</scope>
</dependency>

Post the above the changes, CQLScriptLoadTest fails with below error

java.lang.NoSuchMethodError: com.datastax.driver.core.Cluster$Builder.addContactPoints(Ljava/lang/String;)Lcom/datastax/driver/core/Cluster$Builder;
	at org.cassandraunit.CassandraCQLUnit.load(CassandraCQLUnit.java:42)
	at org.cassandraunit.BaseCassandraUnit.before(BaseCassandraUnit.java:32)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

And SpringCQLScriptLoadTest also fails with below error

me.prettyprint.hector.api.exceptions.HectorException: [localhost(127.0.0.1):9171] All host pools marked down. Retry burden pushed out to client.
	at me.prettyprint.cassandra.connection.HConnectionManager.getClientFromLBPolicy(HConnectionManager.java:401)
	at me.prettyprint.cassandra.connection.HConnectionManager.operateWithFailover(HConnectionManager.java:232)
	at me.prettyprint.cassandra.service.AbstractCluster.describeKeyspaces(AbstractCluster.java:136)
	at org.cassandraunit.utils.EmbeddedCassandraServerHelper.dropKeyspacesWithHector(EmbeddedCassandraServerHelper.java:226)
	at org.cassandraunit.utils.EmbeddedCassandraServerHelper.dropKeyspaces(EmbeddedCassandraServerHelper.java:203)
	at org.cassandraunit.utils.EmbeddedCassandraServerHelper.cleanEmbeddedCassandra(EmbeddedCassandraServerHelper.java:162)
	at org.cassandraunit.spring.AbstractCassandraUnitTestExecutionListener.cleanServer(AbstractCassandraUnitTestExecutionListener.java:106)
	at org.cassandraunit.spring.CassandraUnitTestExecutionListener.afterTestMethod(CassandraUnitTestExecutionListener.java:23)




On Tuesday, 7 June 2016 11:47:49 UTC+5:30, Vinod Jayachandran wrote:
Reply all
Reply to author
Forward
0 new messages