Search code examples
hadoopoozieoozie-coordinator

Add html tag in Oozie email action


I want to send email from oozie where my body content should be in bold.

workflow.xml:

<workflow-app xmlns="uri:oozie:workflow:0.4" name="email-wf">
    <start to="email_action"/>
        <action name="email_action">
        <email xmlns="uri:oozie:email-action:0.2">
            <to>[email protected]</to>
            <subject>Test mail</subject>
            <body><h1>Email sending with heading level 1</h1></body>
            <content_type>text/html</content_type>
        </email>
        <ok to="end"/>
        <error to="fail"/>
    </action>

    <kill name="fail">
        <message>Shell action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name="end"/>
</workflow-app>

job.properties:

OOZIE_URL=http://xxx.xxx.xx.x:11000/oozie
nameNode=hdfs://xxx.xxx.xx.x:8020
jobTracker=xxx.xxx.xx.x:8050
oozie.use.system.libpath=true
oozie.wf.application.path=/tmp/email_workflow.xml

So when i was running oozie command it was giving error:

Error: E0701 : E0701: XML schema error, cvc-type.3.1.2: Element 'body' is a simple type, so it must have no element information item [children].

Can some one help me to understand what is missing in above configuration.


Solution

  • The problem probably occurs because you try to use xml like tags within oozie. This confuses oozie as it thinks it is encountering more actual oozie XML.

    The solution would be to escape the brackets around your h1 statements.

    Either by escaping all relevant characters (where < becomes &lt > becomes &gt), or by trying to escape the whole line with CDATA.