java-级联示例无法编译?

在外壳程序中,我在Im Patient / part1目录中键入了gradle cleanJar。 输出如下。 错误是“找不到org.apache.hadoop.mapred.JobConf的类文件”。 为什么无法编译?

:clean UP-TO-DATE
:compileJava
Download http://conjars.org/repo/cascading/cascading-core/2.0.1/cascading-core-2.0.1.pom
Download http://conjars.org/repo/cascading/cascading-hadoop/2.0.1/cascading-hadoop-2.0.1.pom
Download http://conjars.org/repo/riffle/riffle/0.1-dev/riffle-0.1-dev.pom
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.pom
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-parent/1.6.1/slf4j-parent-1.6.1.pom
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.pom
Download http://conjars.org/repo/thirdparty/jgrapht-jdk1.6/0.8.1/jgrapht-jdk1.6-0.8.1.pom
Download http://repo1.maven.org/maven2/org/codehaus/janino/janino/2.5.16/janino-2.5.16.pom
Download http://conjars.org/repo/cascading/cascading-core/2.0.1/cascading-core-2.0.1.jar
Download http://conjars.org/repo/cascading/cascading-hadoop/2.0.1/cascading-hadoop-2.0.1.jar
Download http://conjars.org/repo/riffle/riffle/0.1-dev/riffle-0.1-dev.jar
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar
Download http://conjars.org/repo/thirdparty/jgrapht-jdk1.6/0.8.1/jgrapht-jdk1.6-0.8.1.jar
Download http://repo1.maven.org/maven2/org/codehaus/janino/janino/2.5.16/janino-2.5.16.jar
/home/is_admin/lab/cascading/Impatient/part1/src/main/java/impatient/Main.java:50: error: cannot access JobConf
    Tap inTap = new Hfs( new TextDelimited( true, "\t" ), inPath );
                ^
  class file for org.apache.hadoop.mapred.JobConf not found
1 error
:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 22.599 secs
Treper asked 2020-08-12T03:35:32Z
5个解决方案
1 votes

尝试使用Java 6,gradle在Java 7中存在一些已知问题

user1801279 answered 2020-08-12T03:35:38Z
1 votes

从hadoop分发中将hadoop-core-1.x.y.jar添加到路径。

这在CoPA示例中对我有用。 我添加到Eclipse构建路径。

将此添加到gradle依赖项{}部分

编译(组:'org.apache.hadoop',名称:'hadoop-core',版本:'1.2.0')

Lalit Jha answered 2020-08-12T03:36:12Z
0 votes

似乎找不到类,请检查构建路径条目中的库。

user2826111 answered 2020-08-12T03:36:32Z
0 votes

我今天在尝试级联不耐烦教程时遇到了同样的问题。 我已经解决了在dependencies部分的hadoop-mapred中添加以下内容的问题:

compile 'org.apache.hadoop:hadoop-client:2.3.0'

我想使用Hadoop 2.3.0,但我想您可以选择自己的Hadoop版本。

PS:为了使用第一个hadoop-mapred软件包,您必须添加以下内容:

compile 'org.apache.hadoop:hadoop-mapred:0.22.0'

您可以在此处找到Hadoop可能需要的所有存储库。

eliasah answered 2020-08-12T03:37:06Z
0 votes

谢谢拉利特添加以下行对我有用,而不必更改任何Java版本。

compile( group: 'org.apache.hadoop', name: 'hadoop-core', version: '1.2.0' )

另外,我什至可以在类路径中添加hadoop-core jar并在gradle路径中提及

Kranthi answered 2020-08-12T03:37:30Z
translate from https://stackoverflow.com:/questions/12511147/cascading-examples-failed-to-compile