【发布时间】:2016-09-10 21:13:38
【问题描述】:
请参考此 dataweave 窗口图片:- dataweave window image
我正在尝试使用 dataweave 将 CSV 转换为 JSON,但即使是最简单的转换,它也会自动创建一个空标记。我可以在预览窗口中看到。当我运行此应用程序时,我收到此错误 *
异常堆栈是: 1. 452 (java.lang.ArrayIndexOutOfBoundsException) com.mulesoft.weave.reader.CharArraySourceReader:21 (null) 2. 452 (java.lang.ArrayIndexOutOfBoundsException)。消息负载的类型为:WeaveMessageProcessor$WeaveOutputHandler (org.mule.api.MessagingException)
org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32**************************************************** ************************************ 根异常堆栈跟踪:java.lang.ArrayIndexOutOfBoundsException: 452 在 com.mulesoft.weave.reader.CharArraySourceReader.lookAheadAscii(CharArraySourceReader.scala:21) 在 com.mulesoft.weave.reader.csv.parser.CSVParser.parse(CSVParser.scala:132) 在 com.mulesoft.weave.reader.csv.parser.CSVParser.elementAt(CSVParser.scala:61) 在 com.mulesoft.weave.reader.csv.parser.CSVParser.contains(CSVParser.scala:38) 在 com.mulesoft.weave.reader.csv.CSVRecordsValue$$anon$1.hasNext(CSVReader.scala:58) 在 scala.collection.Iterator$class.toStream(Iterator.scala:1188) 在 com.mulesoft.weave.reader.csv.CSVRecordsValue$$anon$1.toStream(CSVReader.scala:56)
这是我正在使用的示例 csv
SpreadsheetKeyEmployee,Position,EffectiveDate,BonusPlan,Amount,Currency,IgnorePlanAssignment
1,18211,2016-05-01,BONUS_PLAN1,150,USD
2,18212,2016-05-01,BONUS_PLAN2,150,USD
3,18213,2016-05-01,BONUS_PLAN3,150,USD
4,18214,2016-05-01,BONUS_PLAN4,150,USD
我认为我可能在阅读器配置(对于 csv)方面犯了一些错误,论坛中讨论了类似的问题,但这对 https://forums.mulesoft.com/questions/36378/dataweave-example-of-csv-to-json.html
没有帮助【问题讨论】:
-
需要查看您的配置,连接可能很简单。
标签: mule mule-studio anypoint-studio dataweave