使用datamapper在Mule中映射日期时抛出错误

时间:2014-10-10 18:32:06

标签: mule datamapper mule-studio mule-component

以下是数据映射器中映射的部分

dateTimeFormatter = new java.text.SimpleDateFormat(“yyyy-MM-dd'T'HH:mm:ss”); output.Date_of_Rate_Float__c =(isnull(input.Date_of_Rate_Float)?null:dateTimeFormatter.format(input.Date_of_Rate_Float)); output.Loan_Create_Date__c =(isnull(input.loan_create_date)?null:dateTimeFormatter.format(input.loan_create_date)); output.Estimated_Closing_Date__c =(isnull(input.estimated_closing_date)?null:dateTimeFormatter.format(input.estimated_closing_date));

这会引发以下异常

1. DateConverter does not support default String to 'Date' conversion. (org.apache.commons.beanutils.ConversionException)
  org.apache.commons.beanutils.converters.DateTimeConverter:468 (null)

Root Exception stack trace:
org.apache.commons.beanutils.ConversionException: DateConverter does not support default String to 'Date' conversion.
    at org.apache.commons.beanutils.converters.DateTimeConverter.toDate(DateTimeConverter.java:468)
    at org.apache.commons.beanutils.converters.DateTimeConverter.convertToType(DateTimeConverter.java:343)
    at org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:156)
    at org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:544)
    at com.mulesoft.datamapper.transform.converter.ScalarValueConversion.convert(ScalarValueConversion.java:126)
    at com.mulesoft.datamapper.transform.DataRecordContext.put(DataRecordContext.java:87)
    at com.mulesoft.datamapper.transform.DataRecordContext.put(DataRecordContext.java:24)
    at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeSetAccessor(ReflectiveAccessorOptimizer.java:308)
    at org.mvel2.compiler.CompiledAccExpression.setValue(CompiledAccExpression.java:54)
    at org.mvel2.ast.DeepAssignmentNode.getReducedValueAccelerated(DeepAssignmentNode.java:92)
    at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
    at org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123)
    at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119)
    at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:113)
    at org.mvel2.MVEL.executeExpression(MVEL.java:942)
    at org.mule.el.mvel.MVELExpressionExecutor.execute(MVELExpressionExecutor.java:50)
    at com.mulesoft.datamapper.transform.DataMapperExpressionLanguage.evaluate(DataMapperExpressionLanguage.java:106)
    at com.mulesoft.datamapper.transform.MelRecordTransform.transform(MelRecordTransform.java:56)
    at org.jetel.component.Reformat.execute(Reformat.java:273)
    at org.jetel.graph.Node.run(Node.java:465)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)

********************************************************************************

我无法找到导致此异常的原因,我想寻求帮助来解决此问题。

提前谢谢

1 个答案:

答案 0 :(得分:0)

看起来像是将值传递给format方法。要了解如何制作它" null safe"您可以查看Format a Date, allowing null

上的示例