我在远程群集上运行hadoop 2.2.0 ,在另一台机器上运行Pig 0.12 。我需要让Pig与hadoop进行通信,并且第一步似乎是使用hadoop 2.2.0构建Pig 0.12。这是我做的:
当我从命令行运行“pig”时,我收到以下错误:
ERROR 2998: Unhandled internal error. org/apache/hadoop/hdfs/DistributedFileSystem
java.lang.NoClassDefFoundError: org/apache/hadoop/hdfs/DistributedFileSystem
at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.init(HExecutionEngine.java:173)
at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.init(HExecutionEngine.java:122)
at org.apache.pig.impl.PigContext.connect(PigContext.java:301)
at org.apache.pig.PigServer.<init>(PigServer.java:222)
at org.apache.pig.PigServer.<init>(PigServer.java:207)
at org.apache.pig.tools.grunt.Grunt.<init>(Grunt.java:47)
at org.apache.pig.Main.run(Main.java:538)
at org.apache.pig.Main.main(Main.java:156)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hdfs.DistributedFileSystem
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
答案 0 :(得分:3)
如果在项目中使用maven依赖项,仅使用命令ant clean jar-all -Dhadoopversion=23
或ant jar-withouthadoop –Dhadoopversion=23
构建是不够的。您需要在本地maven仓库中安装由此创建的jar,或者在pom.xml
<dependency>
<groupId>org.apache.pig</groupId>
<artifactId>pig</artifactId>
<version>0.13.0</version>
<classifier>h2</classifier>
</dependency>