Skip to content
Advertisement

Spark cassandra connector Java API, cannot find symbol CassandraRow

I am trying out the spark-cassandra-connector-japi example from here:

https://github.com/datastax/spark-cassandra-connector/blob/master/doc/7_java_api.md

The maven build fails with the following error:

SimpleApp.java:[24,9] cannot find symbol [ERROR] symbol: class CassandraRow [ERROR] location: class SimpleApp

My pom.xml is shown below

<project>
  <groupId>com.example</groupId>
  <artifactId>simple-project</artifactId>
  <modelVersion>4.0.0</modelVersion>
  <name>Simple Project</name>
  <packaging>jar</packaging>
  <version>1.0</version>
  <dependencies>
    <dependency> <!-- Spark dependency -->
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-core_2.10</artifactId>
      <version>1.5.2</version>
    </dependency>
    <dependency>
        <groupId>com.datastax.spark</groupId>
        <artifactId>spark-cassandra-connector_2.10</artifactId>
        <version>1.5.0-M3</version>
    </dependency>
    <dependency>
        <groupId>com.datastax.spark</groupId>
        <artifactId>spark-cassandra-connector-java_2.10</artifactId>
        <version>1.5.0-M3</version>
    </dependency>
    <dependency>
        <groupId>com.datastax.cassandra</groupId>
        <artifactId>cassandra-driver-core</artifactId>
        <version>2.1.9</version>
    </dependency>
    <dependency>
        <groupId>com.datastax.cassandra</groupId>
        <artifactId>cassandra-driver-mapping</artifactId>
        <version>2.1.9</version>
    </dependency>
  </dependencies>
</project>

Where is the class CassandraRow defined? I have gone through the code in package com.datastax.spark.connector.japi.CassandraJavaUtil and it is not defined there. The example asks to only statically import com.datastax.spark.connector.japi for the example to work.

Any pointers would be much appreciated.

Advertisement

Answer

you can make it work doing import com.datastax.spark.connector.CassandraRow;

I’m using the same dependencies as you (regardless of the version)

<dependency>
  <groupId>com.datastax.spark</groupId>
  <artifactId>spark-cassandra-connector-java_2.10</artifactId>
  <version>1.5.0-M2</version>
</dependency>
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement