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

Add html tag in Oozie email action

我想从 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].

谁能帮我理解上面的配置中缺少什么。

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

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

通过转义所有相关字符(其中 < 变为 < > 变为 >),或者通过 trying to escape the whole line 使用 CDATA。