Passing many parameters from Java action to Oozie workflow

by Tabitha.Oepen on 2015-07-05

Passing many parameters from Java action to Oozie workflow

oozie’s ‘capture-output’ is a powerful method the pass dynamic configuration properties from action to action, but you may hit the maximum size limit quite fast.

When executing Java actions in an Oozie workflow, there are going to be cases where you want to have certain data to be passed from your action to the workflow itself, making it avalailable for use within the workflow. This can be easily achieved by adding “capture-output” element to your workflow action, which is an indicator for Oozie to capture the output of your action.

Here’s an example:

<action name="my-java-action">
			<capture-output />
	<ok to="mapreduce-action"/> 
    <error to="fail"/> 

The format of your Java action’s output needs to be in Java properties file format. So, in your action class, write your output to a file which path you must get from looking up in

String oozieProp = System.getProperty("");
OutputStream os = null;
if (oozieProp != null) {
	File propFile = new File(oozieProp);
	Properties p = new Properties();
	p.setProperty("currentTimeMillis", "" + System.currentTimeMillis() );
        os = new FileOutputStream(propFile);, "");
} else {
	throw new RuntimeException(" System property not defined");

Check out an example on how to do this here.

Now do keep in mind that the property file shouldn’t exceed 2 KB in size. If your output is bigger than 2 KB, Oozie launcher will fail and you will get an exception looking (more or less) like this:

Output data exceeds its limit [2048]

Full stacktrace:

SERVER[SERVERNAME] USER[oozie] GROUP[supergroup] TOKEN[] APP[capture-output] JOB[0000009-150701190252776-oozie-oozi-W] ACTION[0000009-150701190252776-oozie-oozi-W@my-java-action] Launcher exception: Output data exceeds its limit [2048]
org.apache.oozie.action.hadoop.LauncherException: Output data exceeds its limit [2048]
    at org.apache.oozie.action.hadoop.LauncherMapper.getLocalFileContentStr(
    at org.apache.oozie.action.hadoop.LauncherMapper.handleActionData(
    at org.apache.hadoop.mapred.MapTask.runOldMapper(
    at org.apache.hadoop.mapred.LocalContainerLauncher$EventHandler.runSubtask
    at org.apache.hadoop.mapred.LocalContainerLauncher$EventHandler.runTask
    at org.apache.hadoop.mapred.LocalContainerLauncher$EventHandler.access$200
    at org.apache.hadoop.mapred.LocalContainerLauncher$EventHandler$
    at java.util.concurrent.Executors$
    at java.util.concurrent.ThreadPoolExecutor.runWorker(
    at java.util.concurrent.ThreadPoolExecutor$

The good news is, you can easily increase the maximum size of the property file, by simply adding the below into oozie-site.xml file. You could of course adjust the value to your need.


Or if you’re using Cloudera Manager, you can adjust the “Oozie Server Advanced Configuration Snippet (Safety Valve) for oozie-site.xml” in Oozie configuration.


Make sure to restart your oozie instance after this configuration change.