2017-02-06 16 views
0

我们有以下Oozie的电子邮件操作Oozie的电子邮件行动逃生标签

<email xmlns="uri:oozie:email-action:0.1"> 
    <to>some-email</to> 
    <subject>some subject Failure</subject> 
    <body> 
     Error (Code) Message:(${wf:errorCode(wf:lastErrorNode())}) ${wf:errorMessage(wf:lastErrorNode())} 
    </body> 
</email> 

错误消息的内容有像<init>一些文字。这会导致oozie电子邮件操作失败并出现以下错误,

JDOMParseException: Error on line 36: The element type \"init\" must be terminated by the matching end-tag \"</init>\". 

我无法找到逃避这些字符的方法。任何建议都会有帮助。

回答

1

这是因为身体需要一个纯文本(见here

您可以使用其他EL functions做简单的XML使用replaceAll逃逸或者你可以将身体编码成UTF-8。

+0

感谢您的回复。看起来,这个问题在oozie 4.x客户端版本中得到修复。在我的情况下,客户端版本是3.xI也走了写一个自定义EL函数的路径,该函数将使用[escapexml](https://commons.apache.org/proper/commons-lang/apidocs/org/ apache/commons/lang3/StringEscapeUtils.html#escapeXml10-java.lang.String-)方法。 – rajkumarts