Groupe: http://groups.google.com/group/cassandra-unit-users/topics
- CassandraUnit error due to cassandra.yaml [1 mise à jour]
- Problem running cassandra unit test example [1 mise à jour]
bird flying <dazh...@gmail.com> Jul 21 07:09PM -0700
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]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.
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.is;
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));
}
}
Jen M <jenmiller...@gmail.com> Jul 21 06:40AM -0700
Hey there,
I did figure out the issue. I was importing a newer version of
antlr-runtime from another portion of the project.
Thanks!
On Sunday, July 20, 2014 11:19:40 AM UTC-4, jsevellec wrote: