dataweave coersion string to array error

时间:2016-09-22 12:45:30

标签: arrays dataweave

我在使用数据编辑转换消息时遇到问题,在mule 3.7中。 输入XML的结构如下: input XML

dataweave代码: DAtaweave code

错误如下: 异常堆栈是: 1.不能强制a:string到a:array(com.mulesoft.weave.model.values.coercion.exception.UnsupportedTypeCoercionException)   com.mulesoft.weave.model.values.formatting.ArrayFormatTypeCoercionValue:31(null) 2.执行时的例外情况:     header_key:payload.data.header.Key,                                      ^ 无法强制a:string到a:array(com.mulesoft.weave.mule.exception.WeaveExecutionException)   com.mulesoft.weave.mule.WeaveMessageProcessor $ WeaveOutputHandler:162(null)

Root异常堆栈跟踪: com.mulesoft.weave.model.values.coercion.exception.UnsupportedTypeCoercionException:无法将:string强制转换为:array     at com.mulesoft.weave.model.values.formatting.ArrayFormatTypeCoercionValue.evaluate(ArrayFormatTypeCoercionValue.scala:31)     at com.mulesoft.weave.model.values.formatting.ArrayFormatTypeCoercionValue.evaluate(ArrayFormatTypeCoercionValue.scala:13)     在com.mulesoft.weave.reader.csv.CSVWriter.writeCSV(CSVWriter.scala:70)     在com.mulesoft.weave.reader.csv.CSVWriter.writeValue(CSVWriter.scala:44)     在com.mulesoft.weave.model.values.Value $ class.write(Value.scala:31)     在com.mulesoft.weave.engine.ast.structure.ObjectNode.write(ObjectNode.scala:11)     在com.mulesoft.weave.engine.Engine.internalExecute(Engine.scala:89)     在com.mulesoft.weave.engine.Engine.execute(Engine.scala:54)     在com.mulesoft.weave.engine.Engine.execute(Engine.scala:169)     在com.mulesoft.weave.mule.WeaveMessageProcessor $ WeaveOutputHandler.write(WeaveMessageProcessor.scala:159)     at org.mule.transformer.simple.ObjectToByteArray.doTransform(ObjectToByteArray.java:63)     at org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:415)     在org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:425)     在org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:373)     at org.mule.DefaultMuleMessage.getPayloadAsBytes(DefaultMuleMessage.java:714)     在org.mule.module.http.internal.listener.HttpResponseBuilder.build(HttpResponseBuilder.java:177)     在org.mule.module.http.internal.listener.HttpMessageProcessorTemplate.sendResponseToClient(HttpMessageProcessorTemplate.java:97)     在org.mule.execution.AsyncResponseFlowProcessingPhase.runPhase(AsyncResponseFlowProcessingPhase.java:83)     在org.mule.execution.AsyncResponseFlowProcessingPhase.runPhase(AsyncResponseFlowProcessingPhase.java:38)     在org.mule.execution.PhaseExecutionEngine $ InternalPhaseExecutionEngine.phaseSuccessfully(PhaseExecutionEngine.java:65)     在org.mule.execution.PhaseExecutionEngine $ InternalPhaseExecutionEngine.phaseSuccessfully(PhaseExecutionEngine.java:69)     在com.mulesoft.mule.throttling.ThrottlingPhase.runPhase(ThrottlingPhase.java:185)     在com.mulesoft.mule.throttling.ThrottlingPhase.runPhase(ThrottlingPhase.java:1)     at org.mule.execution.PhaseExecutionEngine $ InternalPhaseExecutionEngine.process(PhaseExecutionEngine.java:114)     在org.mule.execution.PhaseExecutionEngine.process(PhaseExecutionEngine.java:41)     在org.mule.execution.MuleMessageProcessingManager.processMessage(MuleMessageProcessingManager.java:32)     at org.mule.module.http.internal.listener.DefaultHttpListener $ 1.handleRequest(DefaultHttpListener.java:126)     在org.mule.module.http.internal.listener.grizzly.GrizzlyRequestDispatcherFilter.handleRead(GrizzlyRequestDispatcherFilter.java:83)     在org.glassfish.grizzly.filterchain.ExecutorResolver $ 9.execute(ExecutorResolver.java:119)     在org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)     在org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)     在org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)     在org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)     在org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)     在org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)     在org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)     在org.mule.module.http.internal.listener.grizzly.ExecutorPerServerAddressIOStrategy.run0(ExecutorPerServerAddressIOStrategy.java:102)     在org.mule.module.http.internal.listener.grizzly.ExecutorPerServerAddressIOStrategy.access $ 100(ExecutorPerServerAddressIOStrategy.java:30)     在org.mule.module.http.internal.listener.grizzly.ExecutorPerServerAddressIOStrategy $ WorkerThreadRunnable.run(ExecutorPerServerAddressIOStrategy.java:125)     在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)     at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)     在java.lang.Thread.run(Thread.java:745)

任何人都知道代码有什么问题? 非常感谢!

1 个答案:

答案 0 :(得分:0)

我唯一能看到的是map运算符需要一个数组而payload.data.PO不存在。我知道你没有获得NPE,但是你能检查一下你的错误吗?