CassandraUnit error due to cassandra.yaml

1,391 views
Skip to first unread message

bird flying

unread,
Jul 21, 2014, 10:09:03 PM7/21/14
to cassandra-...@googlegroups.com
Hi all,

   I run CassandraUnit but it always raise under error message.  I want to use Cassandra 2.0.8. I also try the Cassandra 2.0.5 and 2.0.6 but failed too.

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/efeizho/.m2/repository/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/efeizho/.m2/repository/org/slf4j/slf4j-nop/1.6.4/slf4j-nop-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
2014-07-22 09:53:30,321 [main] DEBUG cassandraunit.utils.EmbeddedCassandraServerHelper - Starting cassandra...
2014-07-22 09:53:30,322 [main] DEBUG cassandraunit.utils.EmbeddedCassandraServerHelper - Initialization needed
2014-07-22 09:53:30,635 [main] ERROR cassandra.config.DatabaseDescriptor - Fatal configuration error
org.apache.cassandra.exceptions.ConfigurationException: Invalid yaml
at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:99)
at org.apache.cassandra.config.DatabaseDescriptor.loadConfig(DatabaseDescriptor.java:134)
at org.apache.cassandra.config.DatabaseDescriptor.<clinit>(DatabaseDescriptor.java:110)
at org.cassandraunit.utils.EmbeddedCassandraServerHelper.mkdirs(EmbeddedCassandraServerHelper.java:227)
at org.cassandraunit.utils.EmbeddedCassandraServerHelper.cleanupAndLeaveDirs(EmbeddedCassandraServerHelper.java:199)
at org.cassandraunit.utils.EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.java:95)
at org.cassandraunit.utils.EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.java:65)
at org.cassandraunit.utils.EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.java:49)
at com.ericsson.mpe.services.drc.core.scheduler.database.NewCassandraDataForCQLAccessImplTest.before(NewCassandraDataForCQLAccessImplTest.java:24)
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:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: while parsing a block mapping
 in 'reader', line 10, column 1:
    cluster_name: "Test Cluster"
    ^
expected <block end>, but found BlockMappingStart
 in 'reader', line 29, column 2:
     max_hint_window_in_ms : 10800000 ... 
     ^

at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:570)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143)
at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:230)
at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:159)
at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122)
at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105)
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:120)
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:481)
at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:475)
at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:93)
... 31 more
Invalid yaml
Fatal configuration error; unable to start. See log for stacktrace.

=============My class configuration in pom.xml


    <dependency>
      <groupId>org.apache.cassandra</groupId>
      <artifactId>cassandra-thrift</artifactId>
    </dependency>
    <dependency>
       <groupId>org.apache.cassandra</groupId>
       <artifactId>cassandra-all</artifactId>    
       <version>2.0.5</version>
    </dependency>
    <dependency>
 <groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit-spring</artifactId>
<version>2.0.2.1</version>
<scope>test</scope>
</dependency>
    <dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>2.0.2</version>
    </dependency>
    <dependency>
 <groupId>org.cassandraunit</groupId>
 <artifactId>cassandra-unit</artifactId>
 <version>2.0.2.1</version>
 <scope>test</scope>    
  <exclusions>
                <exclusion>
                    <artifactId>cassandra-all</artifactId>
                    <groupId>org.apache.cassandra</groupId>
                </exclusion>
                <exclusion>
                    <groupId>com.datastax.cassandra</groupId>
                    <artifactId>cassandra-driver-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>     
    </dependency>
===================My test code

import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;

import java.io.IOException;

import me.prettyprint.cassandra.service.CassandraHostConfigurator;
import me.prettyprint.hector.api.Cluster;
import me.prettyprint.hector.api.ddl.KeyspaceDefinition;
import me.prettyprint.hector.api.factory.HFactory;

import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.thrift.transport.TTransportException;
import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
import org.junit.Before;
import org.junit.Test;

public class NewCassandraDataForCQLAccessImplTest {

@Before
public void before() throws TTransportException, IOException, InterruptedException, ConfigurationException {
EmbeddedCassandraServerHelper.startEmbeddedCassandra("another-cassandra.yaml");
}

@Test
public void shouldHaveAnEmbeddedCassandraStartOn9175Port() throws Exception {
Cluster cluster = HFactory.getOrCreateCluster("TestCluster", new CassandraHostConfigurator("localhost:9175"));
assertThat(cluster.getConnectionManager().getActivePools().size(), is(1));
KeyspaceDefinition keyspaceDefinition = cluster.describeKeyspace("system");
assertThat(keyspaceDefinition, notNullValue());
assertThat(keyspaceDefinition.getReplicationFactor(), is(1));

}

}

Amuthan G

unread,
Apr 20, 2015, 12:05:02 PM4/20/15
to cassandra-...@googlegroups.com
You got any help?.. I also running into the same problem

bird flying

unread,
Apr 22, 2015, 4:16:25 AM4/22/15
to cassandra-...@googlegroups.com
   It is due to conflict of 3pp version between CassandraUnit and cassandra server. 


--
Vous recevez ce message, car vous êtes abonné à un sujet dans le groupe Google Groupes "cassandra-unit-users".
Pour vous désabonner de ce sujet, visitez le site https://groups.google.com/d/topic/cassandra-unit-users/6WkmusveHIo/unsubscribe.
Pour vous désabonner de ce groupe et de tous ses sujets, 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.

Ashish Pandey

unread,
May 11, 2015, 8:55:31 PM5/11/15
to cassandra-...@googlegroups.com
Anyone able to resolve this? Can someone please tell me version which works?
Pour vous désabonner de ce groupe et de tous ses sujets, envoyez un e-mail à l'adresse cassandra-unit-users+unsub...@googlegroups.com.

Swarit Arora

unread,
May 14, 2015, 9:27:40 AM5/14/15
to cassandra-...@googlegroups.com
Hi,
This error is caused because of a space before  max_hint_window_in_ms in cassandra.yaml
Cassandra is very rigid in parsing the configuration file.so be careful about spaces there.
Thanks
Swarit

Joanne Zhuo

unread,
May 28, 2015, 11:37:39 AM5/28/15
to cassandra-...@googlegroups.com
For me, I added snakeyaml(version 1.9) and solved the problem.  
Reply all
Reply to author
Forward
0 new messages