2012-03-11 1 views
1

헥터를 통한 카산드라 데이터베이스 연결을 테스트하고 있습니다.헥터 & 카산드라 문제 NoSuchFieldError : DEFAULT_MEMTABLE_THROUGHPUT_IN_MB

java.lang.NoSuchFieldError : DEFAULT_MEMTABLE_THROUGHPUT_IN_MB

누군가가 내가 잘못 무엇을 알고 있나요 내가 JUnit 테스트를 실행할 때하지만 constanly 다음과 같은 메시지가? 당신의 도움에 대한

감사합니다, 여기에 코드

------------------------------------------------------------------------------- 
Test set: com.acolsolutions.trademaniac.CreateSchemaTest 
------------------------------------------------------------------------------- 
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.287 sec <<< FAILURE! 
testAddDropKeyspace(com.acolsolutions.trademaniac.CreateSchemaTest) Time elapsed: 0.218 sec <<< ERROR! 
**java.lang.NoSuchFieldError: DEFAULT_MEMTABLE_THROUGHPUT_IN_MB** 
    at me.prettyprint.cassandra.service.ThriftCfDef.<init>(ThriftCfDef.java:119) 
    at me.prettyprint.hector.api.factory.HFactory.createColumnFamilyDefinition(HFactory.java:658) 
    at com.acolsolutions.trademaniac.CreateSchemaTest.testAddDropKeyspace(CreateSchemaTest.java:59) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    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.InvokeMethod.evaluate(InvokeMethod.java:20) 
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) 
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) 
    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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) 
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236) 
    at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53) 
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123) 
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164) 
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110) 
    at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175) 
    at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107) 
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68) 

그리고 크리스 : 당신이 헥터와 카산드라의 호환되지 않는 버전을 사용하는 것처럼

/* 
* To change this template, choose Tools | Templates 
* and open the template in the editor. 
*/ 
package com.acolsolutions.trademaniac; 

import org.junit.*; 
import static org.junit.Assert.*; 

import com.acolsolutions.trademaniac.migrations.Schema; 
import java.net.UnknownHostException; 
import java.util.Arrays; 
import javassist.NotFoundException; 
import me.prettyprint.cassandra.service.CassandraHostConfigurator; 
import me.prettyprint.cassandra.service.ThriftCluster; 
import me.prettyprint.cassandra.service.ThriftKsDef; 
import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; 
import me.prettyprint.hector.api.factory.HFactory; 
import org.apache.thrift.TException; 
import org.apache.thrift.transport.TTransportException; 

/** 
* 
* @author charms 
*/ 
public class CreateSchemaTest { 

    private ThriftCluster cassandraCluster; 
    private CassandraHostConfigurator cassandraHostConfigurator; 

    public CreateSchemaTest() { 
    } 

    @BeforeClass 
    public static void setUpClass() throws Exception { 
    } 

    @AfterClass 
    public static void tearDownClass() throws Exception { 
    } 

    @Before 
    public void setupCase() throws TTransportException, TException, IllegalArgumentException, 
      NotFoundException, UnknownHostException, Exception { 
    cassandraHostConfigurator = new CassandraHostConfigurator("localhost:9160"); 
    cassandraCluster = new ThriftCluster("Test Cluster", cassandraHostConfigurator); 
    } 

    @After 
    public void tearDown() { 
    } 
    // TODO add test methods here. 
    // The methods must be annotated with annotation @Test. For example: 
    // 
    // @Test 
    // public void hello() {} 
    @Test 
    public void testAddDropKeyspace() throws Exception { 
    ColumnFamilyDefinition cfDef = HFactory.createColumnFamilyDefinition("DynKeyspace", "DynCf"); 
    cassandraCluster.addKeyspace(
     new ThriftKsDef("DynKeyspace", "org.apache.cassandra.locator.SimpleStrategy", 1, Arrays.asList(cfDef))); 

    String ksid2 = cassandraCluster.dropKeyspace("DynKeyspace"); 
    assertNotNull(ksid2); 

    // Now let's wait for schema agreement. 
    cassandraCluster.addKeyspace(new ThriftKsDef("DynKeyspace", "org.apache.cassandra.locator.SimpleStrategy", 1, Arrays.asList(cfDef)), true); 
    ksid2 = cassandraCluster.dropKeyspace("DynKeyspace", true); 
    assertNotNull(ksid2); 
    } 
} 

답변

1

보인다. memtable flushing을 튜닝하는 파라미터 (DEFAULT_MEMTABLE_THROUGHPUT_IN_MB 등)는 튜닝 프로세스를 간소화하기 위해 최신 버전에서 변경되었습니다. 당신이 사용하고있는 헥터와 카산드라의 버전을 정확하게 말할 수 있다면, 상황이 더 명확해질 수 있습니다 ...

+0

Hector와 Cassandra 1.0.7에서 버전 0.8.0-3을 사용하고있었습니다. 나는 1.0-3으로 바꿨다. 그래서 잘하면 지금 작동합니다. 답장을 보내 주셔서 감사합니다. –