Oozie EL函数:尝试将String转换为" java.lang.Double"时出现异常。

时间:2015-04-22 15:47:23

标签: el oozie

我正在尝试运行一个调用EL函数replaceAll()的Oozie工作流。使用replaceAll()的操作就是这个

  <action name="createSuccess">
     <fs>
         <configuration>
             <property>
                 <name>runDate</name>
                 <value>${replaceAll(hdfsDir, nameNode + '/(.+)/' + region + '/([0-9\\-]+)/?', '$2')}</value>
             </property>
         </configuration>
         <mkdir path="${nameNode}/path/run/${region}/${runDate}"/>
         <touchz path="${nameNode}/path/run/${region}/${runDate}/success.txt"/>
     </fs>
     <ok to="end"/>
     <error to="sendEmailKill"/>
  </action>

hdfsDir类似于hdfs:// nameNode:8020 / some / path / region / 2015-04-22,我需要在最后将该日期作为属性获取并使用它。

但是当我执行上述操作时,我遇到了这个例外:

javax.servlet.jsp.el.ELException: An exception occured trying to convert String "hdfs://nameNode:8020" to type "java.lang.Double"
        at org.apache.commons.el.Logger.logError(Logger.java:481)
        at org.apache.commons.el.Logger.logError(Logger.java:498)
        at org.apache.commons.el.Logger.logError(Logger.java:566)
        at org.apache.commons.el.Coercions.coerceToPrimitiveNumber(Coercions.java:440)
        at org.apache.commons.el.Coercions.applyArithmeticOperator(Coercions.java:852)
        at org.apache.commons.el.ArithmeticOperator.apply(ArithmeticOperator.java:83)
        at org.apache.commons.el.BinaryOperatorExpression.evaluate(BinaryOperatorExpression.java:170)
        at org.apache.commons.el.FunctionInvocation.evaluate(FunctionInvocation.java:163)
        at org.apache.commons.el.ExpressionString.evaluate(ExpressionString.java:114)
        at org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:274)
        at org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:190)
        at org.apache.oozie.util.ELEvaluator.evaluate(ELEvaluator.java:203)
        at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:175)
        at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:60)
        at org.apache.oozie.command.XCommand.call(XCommand.java:280)
        at org.apache.oozie.service.CallableQueueService$CompositeCallable.call(CallableQueueService.java:326)
        at org.apache.oozie.service.CallableQueueService$CompositeCallable.call(CallableQueueService.java:255)
        at org.apache.oozie.service.CallableQueueService$CallableWrapper.run(CallableQueueService.java:175)
        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:744)

为什么我会收到此异常以及如何解决此问题?

1 个答案:

答案 0 :(得分:0)

经过试验错误,我发现我不能使用&#34; +&#34;连接两个字符串。我必须用这个:

${replaceAll(hdfsDumpDir, concat(concat(concat(nameNode, '/(.+)/'),  region), '/'), '')}