Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Run oozie wf with java api parameters

Run oozie wf with java api parameters

New Contributor

Hi All,


I'm trying to run oozie workflow with java api, first I have a hive script on hdfs and my wf points to it. I'd like to run it with parameters from Java API.

Here is my code below

 String oozieJobHDFSPath = "hdfs://rpdc/user/hue/oozie/workspaces/hue-oozie-1471864349.89";

    String jobIdOstatki = null;
    OozieClient cl = new OozieClient(OOZIE_URL);
    Properties prop = cl.createConfiguration();

prop.setProperty(cl.APP_PATH, oozieJobHDFSPath );
    prop.setProperty("jobTracker", "");
    prop.setProperty("queueName", "test");
    prop.setProperty("nameNode", "hdfs://rpdc");
    prop.setProperty("", "hdfs");
    prop.setProperty("oozie.use.system.libpath", "true");
    prop.setProperty("security_enabled", "false");
    prop.setProperty("security.passwords.encryption.enabled", "false");
    prop.setProperty("", "8192");

    prop.setProperty("oozie.action.external.stats.param.targetBalancesDB", "test_tmp");
    prop.setProperty("", "2016-01-01");
    prop.setProperty("oozie.action.external.stats.param.dictsDB", "test_auto_dicts");

try {
            System.out.println("Getting Job ID Ostatki status");
            jobIdOstatki =;

while (cl.getJobInfo(jobIdOstatki).getStatus() == WorkflowJob.Status.RUNNING) {
                //System.out.println("Job " +  cl.getJobLog(jobIdOstatki).toString());

But I have in action script different picture...


<workflow-app name="TestBalancesNew" xmlns="uri:oozie:workflow:0.5">
    <start to="hive-c7a4"/>
    <kill name="Kill">
        <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    <action name="hive-c7a4" cred="hcat">
        <hive xmlns="uri:oozie:hive-action:0.2">
        <ok to="End"/>
        <error to="Kill"/>
    <end name="End"/>

I can't see any parameters here. How I could pass them through to hive action?


Thanks in advance for your help.


Re: Run oozie wf with java api parameters

Master Guru
Could you clarify further on what the error you observe is? Are you not seeing your ${var} property variables being substituted with the passed properties when invoked via the OozieClient API?

Re: Run oozie wf with java api parameters

New Contributor

Thanks for response, I have already found the solution. I did not provided the params inside the workflow.xml


Now it seems works fine for me.



Don't have an account?
Coming from Hortonworks? Activate your account here