1

错误信息:

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 中处理而不是在查询中处理呢?

4

1 回答 1

1

你可以试试:

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

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

于 2015-05-05T02:57:24.867 回答