Search code examples
hadoopmapreducehadoop-yarnooziehadoop2

Oozie example map reduce job fails with java.lang.NoSuchFieldError: HADOOP_CLASSPATH


I installed oozie 4.3.0 in hadoop 2.7.3. oozie and hadoop services are up and running.I tried to execute example map reduce job that comes with oozie distribution, when i check the log of the job, it contains these errors.

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)

I searched each and every link in google, but none of the workarounds/solutions proposed worked. Any one has any clue on why this error is occuring.

I can run map reduce jobs with out any problem, and i can see classpath detailes with "hadoop classpath" command at shell prompt.

My job.properties file

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

And the workflow.xml has no changes just the standard file comes with oozie distribution.

oozie-site.xml configuration file is

    <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>

And the command used to run

$ 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

Solution

  • I faced the same issue. After a few searches, I found the source. The oozie compilation produced Hadoop 2.6.0 jars even when specifying Hadoop 2.7.3 with the option "-Dhadoop.version=2.7.3".

    Please do the following:

    • unjar the oozie.war (do this part in a new directory)

      jar -xvf oozie.war

    • delete all Hadoop jars (I did the same for Hive jars) in oozie.war/WEB-INF/lib. In my case, I compiled Oozie for Hadoop 2.7.3 but Hadoop 2.6.0 jars were in the directory.

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

    • create a new oozie.war (you must be in the oozie.war directory)

      jar -cvf oozie.war ./*

    • regenerate the oozie.war binaries for oozie with a prepare-war

      oozie-setup.sh prepare-war

    • the error is no more visible

    Note: you'll have to copy several Hadoop and Hive jars in your libext directory. My libext directory looks like that:

    `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`
    

    When you do a "prepare-war", the libext content is copied to oozie-server/webapps/oozie/WEB-INF/lib/