Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

This provides for a convenient way to access these values directly within the action code.

Java action XML Schema

The XML schema definition for Oozie workflows specifies an 'xs:sequence' for the tags within each action block. Hence, for a valid workflow application, the various tags e.g. prepare, configuration, java-opts, arg, file, archive etc. should be given in the right order. Note that some of the tags are optional, but if used, the order should be kept in mind. For e.g. if using <file> or <archive> to copy some class files from known hdfs locations to your task cache, they should be specified after any <configuration> or <main-class> tags.

  1. job-tracker (required)
  2. name-node (required)
  3. prepare
  4. configuration
  5. main-class (required)
  6. java-opts
  7. arg
  8. file
  9. archive
  10. capture-output

Some tags are required. Rest all are optional.

For more information the XSD for Java action looks like the following:

Code Block
xml
xml

<xs:complexType name="JAVA">
    <xs:sequence>
        <xs:element name="job-tracker" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="name-node" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="prepare" type="workflow:PREPARE" minOccurs="0" maxOccurs="1"/>
        <xs:element name="job-xml" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element name="configuration" type="workflow:CONFIGURATION" minOccurs="0" maxOccurs="1"/>
        <xs:element name="main-class" type="xs:string" minOccurs="1" maxOccurs="1"/>
        <xs:element name="java-opts" type="xs:string" minOccurs="0" maxOccurs="1"/>
        <xs:element name="arg" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element name="file" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element name="archive" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element name="capture-output" type="workflow:FLAG" minOccurs="0" maxOccurs="1"/>
    </xs:sequence>
</xs:complexType>

Authenticating on a Kerberos-enabled cluster

In order for a Java action to succeed on a secure cluster, it must propagate the Hadoop delegation token like in the following code snippet (this is benign on non-secure clusters):

Code Block
java
java

// propagate delegation related props from launcher job to MR job
if (System.getenv("HADOOP_TOKEN_FILE_LOCATION") != null) {
    jobConf.set("mapreduce.job.credentials.binary", System.getenv("HADOOP_TOKEN_FILE_LOCATION"));
}

Examples and Use-Cases

Following are example workflow applications that illustrate use-cases of the Oozie Java action.

...