Mule ExpressionRuntimeException消息有效内容的类型为:LinkedList

时间:2015-05-05 01:38:09

标签: mule raml

错误消息:

Message               : Execution of the expression "payload.get(0).get('ACCESS_TOKEN')" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: LinkedList
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Index: 0, Size: 0 (java.lang.IndexOutOfBoundsException)
  java.util.LinkedList:553 (null)
2. null (java.lang.reflect.InvocationTargetException)
  sun.reflect.GeneratedMethodAccessor323:-1 (null)
3. cannot invoke method: get (java.lang.RuntimeException)
  org.mule.mvel2.optimizers.impl.refl.nodes.MethodAccessor:63 (null)
4. Execution of the expression "payload.get(0).get('ACCESS_TOKEN')" failed. (org.mule.api.expression.ExpressionRuntimeException)
  org.mule.el.mvel.MVELExpressionLanguage:202 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html)
5. Execution of the expression "payload.get(0).get('ACCESS_TOKEN')" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: LinkedList (org.mule.api.transformer.TransformerMessagingException)

代码:

<db:select config-ref="QB_Oracle_Configuration" doc:name="Access">
     <db:parameterized-query><![CDATA[select access_token, access_token_secret from sias_access where EMPLID=#[message.inboundProperties['p_emplId']] AND TRINET_COMPANY=#[message.inboundProperties['p_company']]]]></db:parameterized-query>
</db:select> 
<set-session-variable variableName="accessToken" value="#[payload.get(0).get('ACCESS_TOKEN')]" doc:name="Access token"/>

问题是某些时候某个值来自选择查询的多个值,我该如何过滤。我可以通过WHERE ROWNUM = 1过滤查询来完成,但是如何在查询中处理Mule而不是这个呢?

1 个答案:

答案 0 :(得分:1)

你可以尝试:

#[message.payload[0]['ACCESS_TOKEN']]

如果这仍然引发异常,请分享完整的ERROR而不仅仅是第一行,以便我可以改进我的答案。