转换连接器在Anypoint CloudHub中失败



我有一个变换动作,它的逻辑如下

%dw 2.0
import * from dw::util::Coercions
output application/json
---
{
"quoteId" : vars.setQuoteOppRecIds.Id,
"productCode" : payload.ServiceTypeCode,
"axSequenceNumber" : vars.counter as Number,
"phaseLevel" : payload.PhaseLevel as Number,
"phaseLevelDescription": payload.PhaseLevelDescription,
"projectWeekStart" : payload.PhaseLevelProjectWeekStart as Number,
"projectWeekEnd" : payload.PhaseLevelProjectWeekEnd as Number,
"quantity": payload.Quantity as Number,
"invoicedSinceLast" : payload.InvoicedSinceLast as Number, 
"unitPrice": (payload.UnitPrice replace "," with "") as Number {format: ".00"} as String {format: ".00"} as Number,
"oppId" :  if (isEmpty(vars.inputPayload.Opportunity.OpportunityId)) (vars.oppID) else (vars.inputPayload.Opportunity.OpportunityId) 
}

在本地调试此转换时,它可以正常工作,没有任何问题,但在部署到CloudHub后,它会抛出类似

的错误
Unable to resolve module with identifier dw::util::Coercions. at 2 : 2
at org.mule.weave.v2.el.WeaveExpressionLanguage.compile(WeaveExpressionLanguage.scala:68)
at org.mule.runtime.core.internal.el.dataweave.DataWeaveExpressionLanguageAdaptor.compile(DataWeaveExpressionLanguageAdaptor.java:143)
at org.mule.runtime.core.internal.el.DefaultExpressionManager.compile(DefaultExpressionManager.java:233

我是新的mulesoft,我没有捕捉到这个错误,当调试本地,但为什么它抛出时运行API在CloudHub

脚本中使用的DataWeave包dw::util::Coercions从Mule 4.4.0开始添加到Mule中。您可能在CloudHub中部署到不支持它的早期版本的Mule。把这个应用重新部署到Mule 4.4.0,它应该可以工作了。

或者,由于您的脚本不使用该包提供的任何函数,您可以直接删除导入行。

相关内容

  • 没有找到相关文章

最新更新