Search code examples
javahadoophdfsooziehue

How to run Java Action as oozie workflow with hue interface


I created a test executable jar of a java main method which accepts args[0] = Hadoop . The java program takes in this argument and writes the following string in a text file;

"currentTimeStamp /t Welcome to Hadoop!! /n" 100,000 times.

I used hue interface to create a oozie-workflow for java action. See the workflow.xml below. The oozie-workflow however executes successfully but the action doesn't create or write in the text file. The text file path was /user/ruben123/test.txt. When I run the jar file in local unix server with command java -jar TestRunner.jar "Hadoop", it executes properly and produces the desired output.

I have a single node pseudo cluster running HDP 2.2 as VM provided by Hortonworks.

<workflow-app name="TestRunner" xmlns="uri:oozie:workflow:0.4">
    <start to="TestRunner"/>
    <action name="TestRunner">
        <java>
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <main-class>org.test.TestRunner</main-class>
            <arg>&quot;Hadoop&quot;</arg>
            <capture-output/>
        </java>
        <ok to="end"/>
        <error to="kill"/>
    </action>
    <kill name="kill">
        <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name="end"/>
</workflow-app>

Solution

  • If you use HUE version 3.8 or 3.9 there is a option under the "Workflows" tab. You go through this menu "Workflows->Editors->Workflows".

    And there you will see an option "Create" in the right corner. After you click that button, there will be list of different workflow types (they are all draggable). Drag "Java" workflow and rest should be easy.