Exception in thread "main" java.lang.NoClassDefFoundError: com/twitter/chill/KryoBase
Exception in thread "main" java.lang.NoClassDefFoundError: com/twitter/chill/KryoBase
我正在 java 中使用 datastax cassandra 编写一个简单的 spark-cassandra 程序,但出现以下异常
Exception in thread "main" java.lang.NoClassDefFoundError:
com/twitter/chill/KryoBase Caused by:
java.lang.ClassNotFoundException: com.twitter.chill.KryoBase
pom.xml
<dependency>
<groupId>com.datastax.dse</groupId>
<artifactId>dse-spark-dependencies</artifactId>
<version>5.1.1</version>
<exclusions>
<exclusion>
<groupId>com.datastax.dse</groupId>
<artifactId>dse-java-driver-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
</exclusion>
</exclusions>
</dependency>
App.java
SparkConf conf = new SparkConf().setMaster("local").setAppName("SparkJavaFirst")
.set("spark.cassandra.connection.host", "localhost");
JavaSparkContext sc = new JavaSparkContext(conf);
JavaRDD<CassandraRow> cassandraJavaRDD = CassandraJavaUtil.javaFunctions(sc).
cassandraTable("my_keyspace","my_table" ).
select("my_column");
程序在 JavaSparkContext sc = new JavaSparkContext(conf);
处失败
如有任何帮助,我们将不胜感激。
这个问题得到解决,因为我删除了
的排除项
<groupId>com.datastax.dse</groupId>
<artifactId>dse-java-driver-core</artifactId>
我正在 java 中使用 datastax cassandra 编写一个简单的 spark-cassandra 程序,但出现以下异常
Exception in thread "main" java.lang.NoClassDefFoundError: com/twitter/chill/KryoBase Caused by: java.lang.ClassNotFoundException: com.twitter.chill.KryoBase
pom.xml
<dependency>
<groupId>com.datastax.dse</groupId>
<artifactId>dse-spark-dependencies</artifactId>
<version>5.1.1</version>
<exclusions>
<exclusion>
<groupId>com.datastax.dse</groupId>
<artifactId>dse-java-driver-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
</exclusion>
</exclusions>
</dependency>
App.java
SparkConf conf = new SparkConf().setMaster("local").setAppName("SparkJavaFirst")
.set("spark.cassandra.connection.host", "localhost");
JavaSparkContext sc = new JavaSparkContext(conf);
JavaRDD<CassandraRow> cassandraJavaRDD = CassandraJavaUtil.javaFunctions(sc).
cassandraTable("my_keyspace","my_table" ).
select("my_column");
程序在 JavaSparkContext sc = new JavaSparkContext(conf);
如有任何帮助,我们将不胜感激。
这个问题得到解决,因为我删除了
的排除项 <groupId>com.datastax.dse</groupId>
<artifactId>dse-java-driver-core</artifactId>