title: Oozie: Launch Map-Reduce from Oozie <java> action?
body: <p>I am trying to execute a Map-Reduce task in an Oozie workflow using a <code>&lt;java&gt;</code> action.</p>
  
  <p>O'Reilley's <em>Apache Oozie</em> (Islam and Srinivasan 2015) notes that:</p>
  
  <blockquote>
    <p>While it’s not recommended, Java action can be used to run Hadoop MapReduce jobs because MapReduce jobs are nothing but Java programs after all. The main class invoked can be a Hadoop MapReduce driver and can call Hadoop APIs to run a MapReduce job. In that mode, Hadoop spawns more mappers and reducers as required and runs them on the cluster.</p>
  </blockquote>
  
  <p>However, I'm not having success using this approach.  </p>
  
  <p>The action definition in the workflow looks like this:</p>
  
  <pre><code>&lt;java&gt;
      &lt;!-- Namenode etc. in global configuration --&gt;
      &lt;prepare&gt;
        &lt;delete path="${transformOut}" /&gt;
      &lt;/prepare&gt;
      &lt;configuration&gt;
          &lt;property&gt;
              &lt;name&gt;mapreduce.job.queuename&lt;/name&gt;
              &lt;value&gt;default&lt;/value&gt;
          &lt;/property&gt;
      &lt;/configuration&gt;
      &lt;main-class&gt;package.containing.TransformTool&lt;/main-class&gt;
      &lt;arg&gt;${transformIn}&lt;/arg&gt;
      &lt;arg&gt;${transformOut}&lt;/arg&gt;
      &lt;file&gt;${avroJar}&lt;/file&gt;
      &lt;file&gt;${avroMapReduceJar}&lt;/file&gt;
  &lt;/java&gt;
  </code></pre>
  
  <p>The Tool implementation's <code>main()</code> implementation looks like this:</p>
  
  <pre><code>public static void main(String[] args) throws Exception {
      int res = ToolRunner.run(new TransformTool(), args);
      if (res != 0) {
          throw new Exception("Error running MapReduce.");
      }
  }
  </code></pre>
  
  <p>The workflow will crash with the "Error running MapReduce" exception above every time; <strong>how do I get the output of the MapReduce to diagnose the problem? Is there a problem with using this <code>Tool</code> to run a MapReduce application?</strong> Am I using the wrong API calls?</p>
  
  <p>I am extremely disinclined to use the Oozie <code>&lt;map-reduce&gt;</code> action, as each action in the workflow relies on several separately versioned AVRO schemas.</p>
  
  <p>What's the issue here? I am using the 'new' <code>mapreduce</code> API for the task.</p>
  
  <p>Thanks for any help.</p>