Astyanax“java.lang.NoClassDefFoundError:org / apache / cassandra / dht / Murmur3Partitioner”异常

时间:2013-03-20 19:43:26

标签: cassandra noclassdeffounderror

我创建了一个maven项目,用于连接cassandra数据库并通过cassandra astyanax java客户端插入数据。

maven clean并成功安装构建但是当我运行这个java应用程序时,我得到以下错误

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/cassandra/dht/Murmur3Partitioner
    at com.netflix.astyanax.impl.AstyanaxConfigurationImpl.<init>(AstyanaxConfigurationImpl.java:55)
    at ConnectingAstyanax.cassandraConnection(ConnectingAstyanax.java:23)
    at ConnectingAstyanax.main(ConnectingAstyanax.java:66)
Caused by: java.lang.ClassNotFoundException: org.apache.cassandra.dht.Murmur3Partitioner
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

pom.xml如下

 <modelVersion>4.0.0</modelVersion>
  <groupId>CassandraAstyanax</groupId>
  <artifactId>CassandraAstyanax</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
        <dependency>
              <groupId>com.netflix.astyanax</groupId>
              <artifactId>astyanax-thrift</artifactId>
              <version>1.56.31</version>
              </dependency>
              <dependency>
              <groupId>com.netflix.astyanax</groupId>
              <artifactId>astyanax-core</artifactId>
              <version>1.56.31</version>
              </dependency>
              <dependency>
              <groupId>com.netflix.astyanax</groupId>
              <artifactId>astyanax-cassandra</artifactId>
              <version>1.56.31</version>
              </dependency>
              <dependency>
                <groupId>org.apache.cassandra</groupId>
                <artifactId>cassandra-thrift</artifactId>
                <version>1.1.2</version>
            </dependency>
            <dependency>
                <groupId>org.apache.cassandra</groupId>
                <artifactId>cassandra-all</artifactId>
                <version>1.1.2</version>
            </dependency>


  </dependencies>
</project>

任何帮助解决错误都将受到赞赏..

1 个答案:

答案 0 :(得分:3)

Murmur3Partitioner在Cassandra 1.2中被引入。你需要更新你的pom以获得1.2版本而不是1.1版本。