我一直在尝试让我的简单字数统计程序在Eclipse中运行。我一直收到错误" java.lang.IllegalStateException:未读块数据"。
以下是我的java程序中的代码片段。
String inputFileName = "pom.xml";
SparkConf conf = new SparkConf().setMaster("local").setAppName("wordCount");
JavaSparkContext sc = new JavaSparkContext( conf);
JavaRDD<String> linesRdd = sc.textFile(inputFileName);
long countOfLines = linesRdd.count();
我能够将上面maven项目生成的jar提交到spark集群中。但我还没有能够在Eclipse中运行spark程序。对此有任何帮助表示赞赏。
很少有其他笔记
调用linesRdd.count()时,我得到以下异常。
java.lang.IllegalStateException: unread block data
at java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2449)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1385)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2018)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1942)
....
16/07/22 17:28:10 WARN TaskSetManager: Lost task 0.0 in stage 0.0 (TID 0, localhost): java.lang.IllegalStateException: unread block data
at java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2449)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1385)
以下是我的pom.xml
中包含的依赖项和构建插件 <dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.3.0</version> <!-- 1.6.2 is the latest version, using which Tuple2 class can't be referenced -->
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
谢谢, 人员Prasanna