在Oozie电子邮件操作中添加html标记

时间:2017-02-07 13:51:00

标签: hadoop oozie oozie-coordinator

我想从oozie发送电子邮件,我的正文内容应以粗体显示。

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>test@gmail.com</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

因此,当我运行oozie命令时,它给出了错误:

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].

有人可以帮助我理解上述配置中缺少的内容。

1 个答案:

答案 0 :(得分:3)

问题可能是因为您尝试在oozie中使用类似xml的标记。这让oozie感到困惑,因为它认为它正在遇到更多实际的oozie XML。

解决方案是转义h1语句周围的括号。

通过转发所有相关字符(其中&lt;变得&lt; lt&gt;成为&gt; gt)或trying to escape the whole line转发CDATA。