0

I'm trying to create a Oozie workflow with one action, a java action to launch a program to parse an excel file inside HDFS, so, in order to this java program parse the file I need to pass it the location of the file, without the oozie workflow I just call the jar file with the arguments I need like:

   java -jar myJarFile.jar hdfs:///path/to/the/file.xlsx 

Now in the java action inside the oozie workflow I need to write something like:

<action name="parse-file">
 <java>
  <job-tracker>${jobTracker}</job-tracker>
  <name-node>${nameNode}</name-node>
  <main-class>parseFile</main-class>
  <arg>path/to.the/file.xlsx</arg>
  <file>lib/myJarFile.jar#myJarFile.jar</file>
 </java>
 <ok to="sen-success-email"/>
 <error to="failed-notification-email"/>
</action>

Is this approach correct?

1 Answer 1

1
  • The java action will execute the public static void main(String[] args) of your class. Make sure you use fully specified package name. For example a.b.c.MainClass
  • You don't need the <file> tag if you store myJarFile.jar in a lib directory next your workflow.xml on HDFS. For example:
workflow_dir/workflow.xml
workflow_dir/lib
workflow_dir/lib/myJarFile.jar
  • Make sure you also upload all dependencies with your workflow.

References:

Sign up to request clarification or add additional context in comments.

2 Comments

All right, this is helpful, just one thing, for example I'm running this jar file from the command line: java -cp FileProcessosSQL.jar:'hadoop classpath':'hdfs classpath':'hbase classpath' com.kata.team1.ProcessSQL SqlInsertion.sql Just to be clear about it, in my folder workflow/lib I should put the libraries that are in hadoop class path, HDFS class path and hbase class path ?
That should work. Alternatively, you could also upload dependencies to HDFS, and use oozie.libpath=/path/to/jars,another/path/to/jars in job.properties or define your own sharelib.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.