Reading cookies in Mule ESB

4 Responses

  1. Romario says:

    Hi,

    I tried this but I get the follow stacktrace:
    org.mule.DefaultMuleMessage: setProperty(key, value) called with null value; removing key: flowvarname; please report the following stack trace to dev@mule.codehaus.org
    java.lang.Throwable
    at org.mule.DefaultMuleMessage.setProperty(DefaultMuleMessage.java:470)
    at org.mule.DefaultMuleMessage.setInvocationProperty(DefaultMuleMessage.java:440)
    at robfox.transformers.CookieTransformer.transformMessage(CookieTransformer.java:20)
    at org.mule.transformer.AbstractMessageTransformer.transform(AbstractMessageTransformer.java:141)
    at org.mule.transformer.AbstractMessageTransformer.transform(AbstractMessageTransformer.java:69)
    at org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:370)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.mule.model.resolvers.AbstractEntryPointResolver.invokeMethod(AbstractEntryPointResolver.java:148)
    at org.mule.model.resolvers.ReflectionEntryPointResolver.invoke(ReflectionEntryPointResolver.java:169)
    at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:36)
    at org.mule.component.DefaultComponentLifecycleAdapter.invoke(DefaultComponentLifecycleAdapter.java:339)
    at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:82)
    at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:73)
    at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:122)
    at org.mule.component.AbstractComponent.access$000(AbstractComponent.java:57)
    at org.mule.component.AbstractComponent$1$1.process(AbstractComponent.java:238)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
    at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:94)
    at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:67)

    Can you tell me why this occurs?

    Thanks in advance!

  2. robfox says:

    Most likely the cookieVal contains NULL. This can happen if there’s no cookie with the name provided (cookiname).

    I would suggest putting a breakpoint on line 17 and inspect the cookieObj whilst debugging. There you will be able to see whether the cookie exists or not in the object.

  3. BG says:

    thanks for the assist. Worked perfectly.

  4. Bart says:

    Just found out in certain Mule versions this does not work anymore with the new HTTP connector. message.getInboundProperty(“Set-Cookie”); returns only the first cookie, instead of an array. This is solved in Mule 3.6.3, 3.8.0 M1 and Mule 3.7.3. See https://www.mulesoft.org/jira/browse/MULE-8790.

Leave a Reply

Your email address will not be published. Required fields are marked *