使用java.lang.NoSuchFieldError:HADOOP_CLASSPATH,Oozie示例map reduce作业失败

时间:2016-12-18 04:24:27

标签: hadoop mapreduce yarn oozie hadoop2

我在hadoop 2.7.3中安装了oozie 4.3.0。 oozie和hadoop服务已启动并运行。我尝试执行oozie发行版附带的示例map reduce作业,当我检查作业日志时,它包含这些错误。

2016-12-20 10:46:11,615  INFO ActionStartXCommand:520 - SERVER[data01.teg.io] USER[hadoop] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000000-161220104605103-oozie-hado-W] ACTION[0000000-161220104605103-oozie-hado-W@:start:] Start action [0000000-161220104605103-oozie-hado-W@:start:] with user-retry state : userRetryCount [0], userRetryMax [0], userRetryInterval [10]
2016-12-20 10:46:11,615  INFO ActionStartXCommand:520 - SERVER[data01.teg.io] USER[hadoop] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000000-161220104605103-oozie-hado-W] ACTION[0000000-161220104605103-oozie-hado-W@:start:] [***0000000-161220104605103-oozie-hado-W@:start:***]Action status=DONE
2016-12-20 10:46:11,616  INFO ActionStartXCommand:520 - SERVER[data01.teg.io] USER[hadoop] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000000-161220104605103-oozie-hado-W] ACTION[0000000-161220104605103-oozie-hado-W@:start:] [***0000000-161220104605103-oozie-hado-W@:start:***]Action updated in DB!
2016-12-20 10:46:11,912  INFO WorkflowNotificationXCommand:520 - SERVER[data01.teg.io] USER[-] GROUP[-] TOKEN[-] APP[-] JOB[0000000-161220104605103-oozie-hado-W] ACTION[0000000-161220104605103-oozie-hado-W@:start:] No Notification URL is defined. Therefore nothing to notify for job 0000000-161220104605103-oozie-hado-W@:start:
2016-12-20 10:46:11,921  INFO WorkflowNotificationXCommand:520 - SERVER[data01.teg.io] USER[-] GROUP[-] TOKEN[-] APP[-] JOB[0000000-161220104605103-oozie-hado-W] ACTION[] No Notification URL is defined.Therefore nothing to notify for job 0000000-161220104605103-oozie-hado-W
2016-12-20 10:46:11,959  INFO ActionStartXCommand:520 - SERVER[data01.teg.io] USER[hadoop] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000000-161220104605103-oozie-hado-W] ACTION[0000000-161220104605103-oozie-hado-W@mr-node] Start action [0000000-161220104605103-oozie-hado-W@mr-node] with user-retry state : userRetryCount [0], userRetryMax [0], userRetryInterval [10]
2016-12-20 10:46:12,146  INFO HadoopAccessorService:520 - SERVER[data01.teg.io] USER[hadoop] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000000-161220104605103-oozie-hado-W] ACTION[0000000-161220104605103-oozie-hado-W@mr-node] Processing configuration file [/srv/oozie-4.3.0/distro/target/oozie-4.3.0-distro/oozie-4.3.0/conf/action-conf/default.xml] for action [default] and hostPort [*]
2016-12-20 10:46:12,148  INFO HadoopAccessorService:520 - SERVER[data01.teg.io] USER[hadoop] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000000-161220104605103-oozie-hado-W] ACTION[0000000-161220104605103-oozie-hado-W@mr-node] Processing configuration file [/srv/oozie-4.3.0/distro/target/oozie-4.3.0-distro/oozie-4.3.0/conf/action-conf/map-reduce.xml] for action [map-reduce] and hostPort [*]
2016-12-20 10:46:13,232 ERROR ActionStartXCommand:517 - SERVER[data01.teg.io] USER[hadoop] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000000-161220104605103-oozie-hado-W] ACTION[0000000-161220104605103-oozie-hado-W@mr-node] Error,
java.lang.NoSuchFieldError: HADOOP_CLASSPATH
    at org.apache.hadoop.mapreduce.v2.util.MRApps.setClasspath(MRApps.java:248)
    at org.apache.hadoop.mapred.YARNRunner.createApplicationSubmissionContext(YARNRunner.java:458)
    at org.apache.hadoop.mapred.YARNRunner.submitJob(YARNRunner.java:285)
    at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:240)
    at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1290)
    at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1287)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1698)
    at org.apache.hadoop.mapreduce.Job.submit(Job.java:1287)
    at org.apache.hadoop.mapred.JobClient$1.run(JobClient.java:575)
    at org.apache.hadoop.mapred.JobClient$1.run(JobClient.java:570)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1698)
    at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:570)
    at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:561)
    at org.apache.oozie.action.hadoop.JavaActionExecutor.submitLauncher(JavaActionExecutor.java:1183)
    at org.apache.oozie.action.hadoop.JavaActionExecutor.start(JavaActionExecutor.java:1369)
    at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:234)
    at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:65)
    at org.apache.oozie.command.XCommand.call(XCommand.java:287)
    at org.apache.oozie.service.CallableQueueService$CompositeCallable.call(CallableQueueService.java:332)
    at org.apache.oozie.service.CallableQueueService$CompositeCallable.call(CallableQueueService.java:261)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.oozie.service.CallableQueueService$CallableWrapper.run(CallableQueueService.java:179)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

我搜索了谷歌中的每个链接,但没有提出的解决方法/解决方案。任何人都知道为什么会出现这个错误。

我可以在没有任何问题的情况下运行map reduce作业,我可以看到带有" hadoop classpath"的类路径详细信息。 shell命令提示符。

我的job.properties文件

nameNode=hdfs://localhost:54310
jobTracker=localhost:8032
queueName=default
examplesRoot=examples

oozie.use.system.libpath=true

oozie.wf.application.path=${nameNode}/user/${user.name}/${examplesRoot}apps/map-reduce/workflow.xml
outputDir=map-reduce

而且只有oozie发行版附带的标准文件,workflow.xml没有任何变化。

oozie-site.xml配置文件是

    <configuration>

    <!--
        Refer to the oozie-default.xml file for the complete list of
        Oozie configuration properties and their default values.
    -->

    <!-- Proxyuser Configuration -->



    <property>
        <name>oozie.service.ProxyUserService.proxyuser.hadoop.hosts</name>
        <value>*</value>
        <description>
            List of hosts the '#USER#' user is allowed to perform 'doAs'
            operations.

            The '#USER#' must be replaced with the username o the user who is
            allowed to perform 'doAs' operations.

            The value can be the '*' wildcard or a list of hostnames.

            For multiple users copy this property and replace the user name
            in the property name.
        </description>
    </property>

    <property>
        <name>oozie.service.ProxyUserService.proxyuser.hadoop.groups</name>
        <value>*</value>
        <description>
            List of groups the '#USER#' user is allowed to impersonate users
            from to perform 'doAs' operations.

            The '#USER#' must be replaced with the username o the user who is
            allowed to perform 'doAs' operations.

            The value can be the '*' wildcard or a list of groups.

            For multiple users copy this property and replace the user name
            in the property name.
        </description>
    </property>



<property>
        <name>oozie.service.WorkflowAppService.system.libpath</name>
        <value>hdfs:///user/hadoop/share/lib/</value>
        <description>
            System library path to use for workflow applications.
            This path is added to workflow application if their job properties sets
            the property 'oozie.use.system.libpath' to true.
        </description>
    </property>
 <property>
        <name>oozie.action.retry.interval</name>
        <value>1</value>
        <description>
            The interval between retries of an action in case of failure
        </description>
    </property>
<property>
        <name>oozie.service.HadoopAccessorService.hadoop.configurations</name>
        <value>*=/srv/hadoop-2.7.3/etc/hadoop</value>
        <description>
            Comma separated AUTHORITY=HADOOP_CONF_DIR, where AUTHORITY is the HOST:PORT of
            the Hadoop service (JobTracker, YARN, HDFS). The wildcard '*' configuration is
            used when there is no exact match for an authority. The HADOOP_CONF_DIR contains
            the relevant Hadoop *-site.xml files. If the path is relative is looked within
            the Oozie configuration directory; though the path can be absolute (i.e. to point
            to Hadoop client conf/ directories in the local filesystem.
        </description>
    </property>


</configuration>

用于运行的命令

$ bin/oozie job -oozie http://localhost:11000/oozie -config /srv/oozie-4.3.0/distro/target/oozie-4.3.0-distro/oozie-4.3.0/examples/apps/map-reduce/job.properties -run

$ bin/oozie job -oozie http://localhost:11000/oozie -log  0000003-161218192921381-oozie-hado-W

2 个答案:

答案 0 :(得分:2)

我遇到了同样的问题。经过几次搜索,我找到了源头。即使在使用选项&#34; -Dhadoop.version = 2.7.3&#34;指定Hadoop 2.7.3时,oozie编译也生成了Hadoop 2.6.0 jar。

请执行以下操作:

  • 解开oozie.war(在新目录中执行此部分)

    jar -xvf oozie.war

  • 删除oozie.war / WEB-INF / lib中的所有Hadoop jar(我为Hive jar做了同样的事情)。在我的例子中,我为Hadoop 2.7.3编译了Oozie,但Hadoop 2.6.0罐子在目录中。

    rm -f oozie.war/WEB-INF/lib/hadoop-*.jar rm -f oozie.war/WEB-INF/lib/hive-*.jar

  • 创建一个新的oozie.war(你必须在oozie.war目录中)

    jar -cvf oozie.war ./*

  • 使用准备战争为oozie重新生成oozie.war二进制文件

    oozie-setup.sh prepare-war

  • 错误不再可见

注意:您必须在libext目录中复制几个Hadoop和Hive jar。我的libext目录看起来像这样:

`activation-1.1.jar,apacheds-i18n-2.0.0-M15.jar,apacheds-kerberos-codec-2.0.0-M15.jar,api-asn1-api-1.0.0-M20.jar,api-util-1.0.0-M20.jar,avro-1.7.4.jar,commons-beanutils-core-1.8.0.jar,commons-cli-1.2.jar,commons-codec-1.4.jar,commons-collections-3.2.2.jar,commons-compress-1.4.1.jar,commons-configuration-1.6.jar,commons-digester-1.8.jar,commons-httpclient-3.1.jar,commons-io-2.4.jar,commons-lang-2.6.jar,commons-logging-1.1.3.jar,commons-math3-3.1.1.jar,commons-net-3.1.jar,curator-client-2.7.1.jar,curator-framework-2.7.1.jar,curator-recipes-2.7.1.jar,ext-2.2.zip,gson-2.2.4.jar,guava-11.0.2.jar,hadoop-annotations-2.7.3.jar,hadoop-auth-2.7.3.jar,hadoop-common-2.7.3.jar,hadoop-hdfs-2.7.3.jar,hadoop-mapreduce-client-app-2.7.3.jar,hadoop-mapreduce-client-common-2.7.3.jar,hadoop-mapreduce-client-core-2.7.3.jar,hadoop-mapreduce-client-hs-2.7.3.jar,hadoop-mapreduce-client-jobclient-2.7.3.jar,hadoop-mapreduce-client-shuffle-2.7.3.jar,hadoop-yarn-api-2.7.3.jar,hadoop-yarn-client-2.7.3.jar,hadoop-yarn-common-2.7.3.jar,hadoop-yarn-server-applicationhistoryservice-2.7.3.jar,hadoop-yarn-server-common-2.7.3.jar,hadoop-yarn-server-resourcemanager-2.7.3.jar,hadoop-yarn-server-web-proxy-2.7.3.jar,hive-ant-2.1.0.jar,hive-common-2.1.0.jar,hive-exec-2.1.0.jar,hive-hcatalog-core-2.1.0.jar,hive-jdbc-2.1.0.jar,hive-metastore-2.1.0.jar,hive-serde-2.1.0.jar,hive-service-2.1.0.jar,hive-shims-0.23-2.1.0.jar,hive-shims-0.23.jar,hive-shims-2.1.0.jar,hive-shims-common-2.1.0.jar,hive-webhcat-java-client-2.1.0.jar,htrace-core-3.1.0-incubating.jar,httpclient-4.2.5.jar,httpcore-4.2.5.jar,jackson-core-asl-1.9.13.jar,jackson-jaxrs-1.9.13.jar,jackson-mapper-asl-1.9.13.jar,jackson-xc-1.9.13.jar,jaxb-api-2.2.2.jar,jaxb-impl-2.2.3-1.jar,jersey-client-1.9.jar,jersey-core-1.9.jar,jetty-6.1.26.jar,jetty-util-6.1.26.jar,jsr305-3.0.0.jar,leveldbjni-all-1.8.jar,libfb303-0.9.3.jar,log4j-1.2.17.jar,mysql-connector-java-5.1.25-bin.jar,netty-3.6.2.Final.jar,paranamer-2.3.jar,protobuf-java-2.5.0.jar,servlet-api-2.5.jar,slf4j-api-1.7.10.jar,slf4j-log4j12-1.7.10.jar,snappy-java-1.0.4.1.jar,stax-api-1.0-2.jar,xercesImpl-2.9.1.jar,xml-apis-1.3.04.jar,xmlenc-0.52.jar,xz-1.0.jar,zookeeper-3.4.6.jar`

当您执行&#34; prepare-war&#34;时,libext内容将被复制到oozie-server / webapps / oozie / WEB-INF / lib /

答案 1 :(得分:0)

转到ozzie服务器lib目录

cd $OOZIE_HOME/oozie-server/webapps/oozie/WEB-INF/lib

列出hadoop罐子   ls -l hadoop*.jar

所有列出的罐子应该是相同版本,并且应该与您安装的hadoop版本匹配,删除任何不同版本的罐子并重新启动oozie