Anypoint CloudHub 中的转换连接器失败
Transform connector fails in the 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 的新手 我在本地调试时没有捕获到这个错误,但是为什么当 运行 CloudHubAPI 中的
时它会抛出
脚本中使用的 DataWeave 包 dw::util::Coercions
was added to Mule since Mule 4.4.0. 您可能在 CloudHub 中部署到不支持它的早期版本的 Mule。将应用程序重新部署到 Mule 4.4.0,它应该可以工作。
或者,由于您的脚本不使用该包提供的任何功能,您可以删除导入行。
我有一个转换动作,其逻辑如下
%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 的新手 我在本地调试时没有捕获到这个错误,但是为什么当 运行 CloudHubAPI 中的
时它会抛出脚本中使用的 DataWeave 包 dw::util::Coercions
was added to Mule since Mule 4.4.0. 您可能在 CloudHub 中部署到不支持它的早期版本的 Mule。将应用程序重新部署到 Mule 4.4.0,它应该可以工作。
或者,由于您的脚本不使用该包提供的任何功能,您可以删除导入行。