Search code examples
hadoopooziecloudera-cdhoozie-workflow

400 Bad Request executing oozie job


I'm trying to execute an Oozie job via it's Web services API (Oozie 4.1.0-cdh5.15.2). Previously this job was successfully executed via Oozie command line API and the most parameters were provided as the command parameters.

The workflow.xml is currently on the HDFS, so I'm just trying to send job properties in XML as it is specified in the documentation:

POST /oozie/v1/jobs
Content-Type: application/xml;charset=UTF-8
.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <property>
        <name>oozie.use.system.libpath</name>
        <value>true</value>
    </property>
    <property>
        <name>oozie.credentials.skip</name>
        <value>true</value>
    </property>
    <property>
        <name>oozie.wf.application.path</name>
        <value>hdfs://myownhdfs.com:8020/path/to/oozie/workflow/workflow.xml</value>
    </property>
    <property>
        <name>jobTracker</name>
        <value>myownhdfs.com:8032</value>
    </property>
    <property>
        <name>nameNode</name>
        <value>hdfs://myownhdfs.com:8020</value>
    </property>
    <property>
        <name>customScripts</name>
        <value>/nfs/path/to/scripts</value>
    </property>
</configuration>

My workflow.xml

<?xml version="1.0" encoding="UTF-8"?>
<workflow-app
        xmlns="uri:oozie:workflow:0.5"
        name="wf-check">
    <global>
        <job-tracker>${jobTracker}</job-tracker>
        <name-node>${nameNode}</name-node>
    </global>
    <start to="py-check" />
    <action name="py-check">
        <python xmlns="uri:oozie:custom-python-action:0.1">
            <custom-scripts>${customScripts}</custom-scripts>
            <script>foo/bar/myscript.py</script>
            <debug-sleep-begin>0</debug-sleep-begin>
            <debug-sleep-end>0</debug-sleep-end>
            <log-level>DEBUG</log-level>
            <capture-output />
        </python>
        <ok to="end" />
        <error to="fail" />
    </action>
    <kill name="fail">
        <message>Python failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name="end" />
</workflow-app>

However I only get 400 Bad Request: The request sent by the client was syntactically incorrect..

Does anybody has a hint, what I could've done wrong?


Solution

  • I executed the same request with curl (previously I was testing with java's URLConnection) and found 2 headers in the response that give more helpful information about an error: oozie-error-code and oozie-error-message. The second one contains also the error code so no need to log both of them.

    HTTP/1.1 400 Bad Request
    ...
    oozie-error-code: E0504
    oozie-error-message: E0504: App directory [/foo/bar] does not exist