Skip to content
This repository was archived by the owner on Apr 5, 2022. It is now read-only.
This repository was archived by the owner on Apr 5, 2022. It is now read-only.

spring-yarn examples not finding / using hadoop classpath #21

@quux00

Description

@quux00

I'm trying to run the yarn examples. I tried both simple-command and batch-files on a Hortonworks HDP-2.1 multi-node (non-secured) cluster.

The job submits fine, but it fails with:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    at org.springframework.yarn.launch.AbstractCommandLineRunner.<clinit>(AbstractCommandLineRunner.java:60)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 1 more

The only modifications to the application-context.xml and appmaster-context.xml was to edit the paths to where I copied the jars that get built with gradlew. For example, here is (part of) the simple-master application-context.xml:

    <yarn:configuration>
            fs.defaultFS=${hd.fs}
            yarn.resourcemanager.address=${hd.rm}
            fs.hdfs.impl=org.apache.hadoop.hdfs.DistributedFileSystem
    </yarn:configuration>

    <yarn:localresources>
            <yarn:hdfs path="/user/u070072/spring-yarn/app/simple-command/*.jar"/>
            <yarn:hdfs path="/user/u070072/spring-yarn/lib/*"/>
    </yarn:localresources>

    <yarn:environment>
            <yarn:classpath use-yarn-app-classpath="true"/>
    </yarn:environment>

    <util:properties id="arguments">
            <prop key="container-count">4</prop>
    </util:properties>

    <yarn:client app-name="simple-command">
            <yarn:master-runner arguments="arguments"/>
    </yarn:client>

and the appmaster-context.xml:

    <yarn:configuration>
            fs.defaultFS=${hd.fs}
            yarn.resourcemanager.address=${hd.rm}
            fs.hdfs.impl=org.apache.hadoop.hdfs.DistributedFileSystem
    </yarn:configuration>

   <yarn:localresources>
            <yarn:hdfs path="/user/u070072/spring-yarn/app/simple-command/*.jar"/>
            <yarn:hdfs path="/user/u070072/spring-yarn/lib/*"/>
    </yarn:localresources>

    <yarn:environment>
            <yarn:classpath use-yarn-app-classpath="true" delimiter=":">
                    ./*
            </yarn:classpath>
    </yarn:environment>

    <yarn:master>
            <yarn:container-allocator/>
            <yarn:container-command>
                    <![CDATA[
                    date
                    1><LOG_DIR>/Container.stdout
                    2><LOG_DIR>/Container.stderr
                    ]]>
            </yarn:container-command>
    </yarn:master>

I invoked it with:

$ ./gradlew -q run-yarn-examples-simple-command -Dhd.fs=hdfs://trvlapp0049:8020 \
-Dhd.rm=http://trvlapp0050.tsh.thomson.com:8050 -Dlocalresources.remote=hdfs://trvlapp0049:8020

The apache-commons-logging jar it wants is in /usr/lib/hadoop/lib:

u070072@TST yarn$ ls -1 /usr/lib/hadoop/lib/ | grep commons-logging
commons-logging-1.1.3.jar

and that location is in the standard hadoop classpath on the HDP platform:

$ hadoop classpath
/etc/hadoop/conf:/usr/lib/hadoop/lib/*:/usr/lib/hadoop/.//*:/usr/lib/hadoop-hdfs/./:/usr/lib/hadoop-hdfs/lib/*:/usr/lib/hadoop-hdfs/.//*:/usr/lib/hadoop-yarn/lib/*:/usr/lib/hadoop-yarn/.//*:/usr/lib/hadoop-mapreduce/lib/*:/usr/lib/hadoop-mapreduce/.//*::/usr/share/java/mysql-connector-java-5.1.17.jar:/usr/share/java/mysql-connector-java.jar:/usr/lib/hadoop-mapreduce/*:/usr/lib/tez/*:/usr/lib/tez/lib/*:/etc/tez/conf

So why isn't the spring-yarn setup finding the commons-logging jar? I've run other YARN apps (not with spring-yarn) and everything works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions