I am trying to make changes in the sample Java Code provided by Spark JavaKafkaWordCount.java
and trying to build it using Maven. I am working on Spark standalone module.
I am using following pom.xml:
<project>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</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.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-kafka_2.10</artifactId>
<version>1.5.1</version>
</dependency>
</dependencies>
</project>
When I run
mvn package
I get the following errors:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project my-app: Compilation failure: Compilation failure:
[ERROR] /root/my-app/src/main/java/com/mycompany/app/JavaKafkaWordCount.java:[17,34] package org.apache.spark.streaming does not exist
[ERROR] /root/my-app/src/main/java/com/mycompany/app/JavaKafkaWordCount.java:[18,43] package org.apache.spark.streaming.api.java does not exist
[ERROR] /root/my-app/src/main/java/com/mycompany/app/JavaKafkaWordCount.java:[19,43] package org.apache.spark.streaming.api.java does not exist
[ERROR] /root/my-app/src/main/java/com/mycompany/app/JavaKafkaWordCount.java:[20,43] package org.apache.spark.streaming.api.java does not exist
[ERROR] /root/my-app/src/main/java/com/mycompany/app/JavaKafkaWordCount.java:[21,43] package org.apache.spark.streaming.api.java does not exist
[ERROR] /root/my-app/src/main/java/com/mycompany/app/JavaKafkaWordCount.java:[39,5] cannot find symbol
[ERROR] symbol: class JavaStreamingContext
[ERROR] location: class com.mycompany.app.JavaKafkaWordCount
[ERROR] /root/my-app/src/main/java/com/mycompany/app/JavaKafkaWordCount.java:[39,37] cannot find symbol
[ERROR] symbol: class JavaStreamingContext
[ERROR] location: class com.mycompany.app.JavaKafkaWordCount
[ERROR] /root/my-app/src/main/java/com/mycompany/app/JavaKafkaWordCount.java:[39,73] cannot find symbol
[ERROR] symbol: class Duration
[ERROR] location: class com.mycompany.app.JavaKafkaWordCount
[ERROR] /root/my-app/src/main/java/com/mycompany/app/JavaKafkaWordCount.java:[48,5] cannot find symbol
[ERROR] symbol: class JavaPairReceiverInputDStream
[ERROR] location: class com.mycompany.app.JavaKafkaWordCount
[ERROR] /root/my-app/src/main/java/com/mycompany/app/JavaKafkaWordCount.java:[48,5] cannot find symbol
[ERROR] symbol: class JavaPairReceiverInputDStream
[ERROR] location: class com.mycompany.app.JavaKafkaWordCount
[ERROR] /root/my-app/src/main/java/com/mycompany/app/JavaKafkaWordCount.java:[49,23] cannot access org.apache.spark.streaming.dstream.ReceiverInputDStream
[ERROR] class file for org.apache.spark.streaming.dstream.ReceiverInputDStream not found
[ERROR] /root/my-app/src/main/java/com/mycompany/app/JavaKafkaWordCount.java:[51,5] cannot find symbol
[ERROR] symbol: class JavaDStream
[ERROR] location: class com.mycompany.app.JavaKafkaWordCount
[ERROR] /root/my-app/src/main/java/com/mycompany/app/JavaKafkaWordCount.java:[58,5] cannot find symbol
[ERROR] symbol: class JavaDStream
[ERROR] location: class com.mycompany.app.JavaKafkaWordCount
[ERROR] /root/my-app/src/main/java/com/mycompany/app/JavaKafkaWordCount.java:[65,5] cannot find symbol
[ERROR] symbol: class JavaPairDStream
[ERROR] location: class com.mycompany.app.JavaKafkaWordCount
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
It seems that I have to modify my PATH variable but I am unable to locate the proper jar.
The error message you are getting is:
package org.apache.spark.streaming.api.java does not exist
This means you are missing the following dependency:
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.10</artifactId>
<version>1.5.1</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With