Mixing expressions in a Catch Exception Strategy for Mule 3.3 - mule

I'm trying to implement error handling logic in my Mule flow and I want to test for HTTP status codes. I've implemented a Message filter, and want my catch-exception-strategy to catch the org.mule.api.routing.filter.FilterUnacceptedException the message-property-filter throws, which I can do, but I want it to be almost nested, but I know I can't do that, so I'm combining my logic statement by an AND operation, like so:
<catch-exception-strategy when="#[exception.causedBy(org.mule.api.routing.filter.FilterUnacceptedException) && header:INBOUND:http.status=404]" doc:name="Catch Exception Strategy">
How ever this is causing an error in my flow when it is hit:
[11-03 19:42:33] ERROR CatchMessagingExceptionStrategy [[fault_test].connector.http.mule.default.receiver.02]:
********************************************************************************
Message : Message has been rejected by filter. Message payload is of type: ReleasingInputStream
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Message has been rejected by filter. Message payload is of type: ReleasingInputStream (org.mule.api.routing.filter.FilterUnacceptedException)
org.mule.routing.MessageFilter:100 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/routing/filter/FilterUnacceptedException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.api.routing.filter.FilterUnacceptedException: Message has been rejected by filter. Message payload is of type: ReleasingInputStream
at org.mule.routing.MessageFilter.filterUnacceptedException(MessageFilter.java:100)
at org.mule.processor.AbstractFilteringMessageProcessor.handleUnaccepted(AbstractFilteringMessageProcessor.java:62)
at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:48)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
[11-03 19:42:33] ERROR CatchMessagingExceptionStrategy [[fault_test].connector.http.mule.default.receiver.02]: Failed to dispatch message to error queue after it failed to process. This may cause message loss.Logging Message here:
org.mule.DefaultMuleMessage
{
id=856cd942-2618-11e2-9e97-f5a070de55a6
payload=org.mule.transport.http.ReleasingInputStream
correlationId=<not set>
correlationGroup=-1
correlationSeq=-1
encoding=UTF-8
exceptionPayload=org.mule.message.DefaultExceptionPayload#e90e23
Message properties:
INVOCATION scoped properties:
INBOUND scoped properties:
Connection=true
Content-Type=text/xml;charset=UTF-8
Date=Sat, 03 Nov 2012 07:42:32 CDT
Keep-Alive=true
MULE_ENCODING=UTF-8
MULE_SESSION=rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAEWgAFdmFsaWRMAA1mbG93Q29uc3RydWN0dAAmTG9yZy9tdWxlL2FwaS9jb25zdHJ1Y3QvRmxvd0NvbnN0cnVjdDtMAAJpZHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wAD3NlY3VyaXR5Q29udGV4dHQAJ0xvcmcvbXVsZS9hcGkvc2VjdXJpdHkvU2VjdXJpdHlDb250ZXh0O3hwAXB0ACQ4NTVjMTA1Yy0yNjE4LTExZTItOWU5Ny1mNWEwNzBkZTU1YTZwc3IAJWphdmEudXRpbC5Db2xsZWN0aW9ucyRTeW5jaHJvbml6ZWRNYXAbc/kJS0s5ewMAAkwAAW10AA9MamF2YS91dGlsL01hcDtMAAVtdXRleHQAEkxqYXZhL2xhbmcvT2JqZWN0O3hwc3IAJG9yZy5tdWxlLnV0aWwuQ2FzZUluc2Vuc2l0aXZlSGFzaE1hcJ3R2e9nRc4AAwAAeHB3DD9AAAAAAAAQAAAAAHhxAH4ACXh4
Server=Mule EE Core Extensions/3.3.0
Set-Cookie=[Lorg.apache.commons.httpclient.Cookie;#9f2588
Transfer-Encoding=chunked
http.headers={MULE_SESSION=rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAEWgAFdmFsaWRMAA1mbG93Q29uc3RydWN0dAAmTG9yZy9tdWxlL2FwaS9jb25zdHJ1Y3QvRmxvd0NvbnN0cnVjdDtMAAJpZHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wAD3NlY3VyaXR5Q29udGV4dHQAJ0xvcmcvbXVsZS9hcGkvc2VjdXJpdHkvU2VjdXJpdHlDb250ZXh0O3hwAXB0ACQ4NTVjMTA1Yy0yNjE4LTExZTItOWU5Ny1mNWEwNzBkZTU1YTZwc3IAJWphdmEudXRpbC5Db2xsZWN0aW9ucyRTeW5jaHJvbml6ZWRNYXAbc/kJS0s5ewMAAkwAAW10AA9MamF2YS91dGlsL01hcDtMAAVtdXRleHQAEkxqYXZhL2xhbmcvT2JqZWN0O3hwc3IAJG9yZy5tdWxlLnV0aWwuQ2FzZUluc2Vuc2l0aXZlSGFzaE1hcJ3R2e9nRc4AAwAAeHB3DD9AAAAAAAAQAAAAAHhxAH4ACXh4, Transfer-Encoding=chunked, Date=Sat, 03 Nov 2012 07:42:32 CDT, MULE_ENCODING=UTF-8, Keep-Alive=true, Set-Cookie=[Lorg.apache.commons.httpclient.Cookie;#9f2588, Connection=true, http.status=500, Content-Type=text/xml;charset=UTF-8, Server=Mule EE Core Extensions/3.3.0}
http.method=POST
http.query.params={}
http.query.string=
http.status=500
http.version=HTTP/1.1
OUTBOUND scoped properties:
MULE_ENCODING=UTF-8
MULE_SESSION=rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAEWgAFdmFsaWRMAA1mbG93Q29uc3RydWN0dAAmTG9yZy9tdWxlL2FwaS9jb25zdHJ1Y3QvRmxvd0NvbnN0cnVjdDtMAAJpZHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wAD3NlY3VyaXR5Q29udGV4dHQAJ0xvcmcvbXVsZS9hcGkvc2VjdXJpdHkvU2VjdXJpdHlDb250ZXh0O3hwAXB0ACQ4NTVjMTA1Yy0yNjE4LTExZTItOWU5Ny1mNWEwNzBkZTU1YTZwc3IAJWphdmEudXRpbC5Db2xsZWN0aW9ucyRTeW5jaHJvbml6ZWRNYXAbc/kJS0s5ewMAAkwAAW10AA9MamF2YS91dGlsL01hcDtMAAVtdXRleHQAEkxqYXZhL2xhbmcvT2JqZWN0O3hwc3IAJG9yZy5tdWxlLnV0aWwuQ2FzZUluc2Vuc2l0aXZlSGFzaE1hcJ3R2e9nRc4AAwAAeHB3DD9AAAAAAAAQAAAAAHhxAH4ACXh4
SESSION scoped properties:
}
org.mule.api.MessagingException: [Error: was expecting type: java.lang.Boolean; but found type: java.util.Map]
[Near : {... eader:INBOUND:http.status=404 ....}]
^
[Line: 1, Column: 110] (org.mule.api.expression.InvalidExpressionException). Message payload is of type: ReleasingInputStream
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:35)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:43)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:93)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:57)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:29)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:90)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:43)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:85)
at org.mule.exception.TemplateMessagingExceptionStrategy.route(TemplateMessagingExceptionStrategy.java:136)
at org.mule.exception.TemplateMessagingExceptionStrategy.handleException(TemplateMessagingExceptionStrategy.java:46)
at org.mule.exception.ChoiceMessagingExceptionStrategy.handleException(ChoiceMessagingExceptionStrategy.java:44)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:45)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:18)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:58)
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:48)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54)
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:44)
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:44)
at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:52)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:113)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:34)
at org.mule.transport.http.HttpMessageReceiver$HttpWorker.doRequest(HttpMessageReceiver.java:305)
at org.mule.transport.http.HttpMessageReceiver$HttpWorker.processRequest(HttpMessageReceiver.java:251)
at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:163)
at org.mule.work.WorkerContext.run(WorkerContext.java:311)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.mule.api.expression.InvalidExpressionException: [Error: was expecting type: java.lang.Boolean; but found type: java.util.Map]
[Near : {... eader:INBOUND:http.status=404 ....}]
^
[Line: 1, Column: 110]
at org.mule.el.mvel.MVELExpressionLanguage.validate(MVELExpressionLanguage.java:244)
at org.mule.el.mvel.MVELExpressionLanguage.evaluateInternal(MVELExpressionLanguage.java:195)
at org.mule.el.mvel.MVELExpressionLanguage.evaluate(MVELExpressionLanguage.java:169)
at org.mule.expression.DefaultExpressionManager.evaluate(DefaultExpressionManager.java:234)
at org.mule.expression.DefaultExpressionManager.evaluateBoolean(DefaultExpressionManager.java:361)
at org.mule.routing.filters.ExpressionFilter.accept(ExpressionFilter.java:127)
at org.mule.routing.ChoiceRouter.selectProcessors(ChoiceRouter.java:35)
at org.mule.routing.AbstractSelectiveRouter.process(AbstractSelectiveRouter.java:194)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
... 34 more
Is there way to implement this type of logic in Mule?

The problem is that you are mixing expression evaluator. Your when clause should look like the following:
<catch-exception-strategy when="#[exception.causedBy(org.mule.api.routing.filter.FilterUnacceptedException) and message.inboundProperties['http.status']=404 ]" doc:name="Catch Exception Strategy">
Here you can find the documentation about MEL

Related

Spring AMQP (RabbitMQ) Throwing Channel Shutdown Error

I am trying to do channel.basicReject() to requeue message based on some condition by creating an MethodInterceptor ConsumerAdvice and adding it to SMLC factor.setAdviceChain(new ConsumerAdvice()). I also have concurrentConsumer configuration which is set to 10. The moment my reject condition is met I issue basicReject command and it gets redelivered and processed by another consumer. During this redelivery process I get the below error,
2019-11-07 17:34:13.268 ERROR 29385 --- [ 127.0.0.1:5672] o.s.a.r.c.CachingConnectionFactory : Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80)
2019-11-07 17:34:13.268 DEBUG 29385 --- [ool-2-thread-13] o.s.a.r.listener.BlockingQueueConsumer : Received shutdown signal for consumer tag=amq.ctag-HUaN71TZUqMfLDR7k6LwGQ
com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80)
at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:516)
at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:346)
at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:178)
at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:111)
at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:670)
at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:48)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:597)
at java.lang.Thread.run(Thread.java:748)
My message is not getting lost but I am seeing a bunch of above errors and unable to understand why this is happening. If anyone has any clues please guide me.
Below are the trace logs,
2019-11-08 02:11:31.883 TRACE 8695 --- [askExecutor-138] o.s.a.r.c.CachingConnectionFactory : AMQChannel(amqp://guest#127.0.0.1:5672/,99) channel.getChannelNumber()
2019-11-08 02:11:31.883 INFO 8695 --- [askExecutor-138] c.g.s.w.consumer.advice.ArgumentUtils : Channel number before triggering redelivery : 99
2019-11-08 02:11:31.883 TRACE 8695 --- [askExecutor-138] o.s.a.r.c.CachingConnectionFactory : AMQChannel(amqp://guest#127.0.0.1:5672/,99) channel.basicReject([2, true])
2019-11-08 02:11:31.883 INFO 8695 --- [askExecutor-138] c.g.s.w.consumer.advice.ArgumentUtils : ==============================================================================
2019-11-08 02:11:31.883 INFO 8695 --- [askExecutor-138] c.g.s.w.consumer.advice.ConsumerAdvice : Requeue Message attempted, status : true
2019-11-08 02:11:31.884 TRACE 8695 --- [askExecutor-138] o.s.a.r.l.SimpleMessageListenerContainer : Waiting for message from consumer.
2019-11-08 02:11:31.884 TRACE 8695 --- [askExecutor-138] o.s.a.r.listener.BlockingQueueConsumer : Retrieving delivery for Consumer#7783912f: tags=[[amq.ctag-eY7LN-1pSXPX8FKRBgt-ug]], channel=Cached Rabbit Channel: AMQChannel(amqp://guest#127.0.0.1:5672/,99), conn: Proxy#37ffe4f3 Shared Rabbit Connection: SimpleConnection#708dfe10 [delegate=amqp://guest#127.0.0.1:5672/, localPort= 58638], acknowledgeMode=AUTO local queue size=0
2019-11-08 02:11:31.884 DEBUG 8695 --- [askExecutor-138] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it
com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80)
at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.checkShutdown(BlockingQueueConsumer.java:436)
at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.nextMessage(BlockingQueueConsumer.java:501)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:843)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:832)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$700(SimpleMessageListenerContainer.java:78)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1073)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80)
at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:516)
at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:346)
at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:178)
at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:111)
at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:670)
at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:48)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:597)
... 1 common frames omitted
2019-11-08 02:11:31.884 ERROR 8695 --- [ 127.0.0.1:5672] o.s.a.r.c.CachingConnectionFactory : Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 2, class-id=60, method-id=90)
You need to show your code and configuration.
It seems like the SMLC has its default configuration to automatically acknowledge messages and this failure is because you already rejected it; why are you interacting with the channel directly?
You can simply throw an exception and the container will reject the message on your behalf.
I don't know if it will helpful for someone.
I had the same error because of invalid input data. But when I added next properties:
"rabbit.listener.acknowledgeMode": "MANUAL",
"rabbit.listener.defaultRequeueRejected": "true",
"rabbit.listener.prefetchCount": "1",
the problem stop to break my program but only had stopping my listener

Mule "this transformer needs a valid endpoint" error only in runtime not in studio

I get a transformer exception running my project on Mule ESB 3.7.5 on Red Hat Enterprise Linux, but not when I run the same project in Anypoint Studio with Mule 3.7.5 on Windows. This exception occurs when I use this transformer:
<dw:transform-message doc:name="Transform Message to MoodleCourse" metadata:id="d3a95670-da14-4d1c-b4df-9eb559593dfb">
<dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
{
academicYear: payload.collegejaar,
category: payload.organisatieonderdeel,
fullName: payload.lange_naam_nl,
idNumber: payload.cursus,
shortName: payload.cursus,
summary: payload.doel,
teachers: payload.docenten map ((docenten , indexOfDocenten) -> {
userName: docenten.medewerker
}),
teachingCycles: payload.aanvangsblok_onderwijsvormen map ((aanvangsblokonderwijsvorman , indexOfAanvangsblokonderwijsvorman) -> {
name: aanvangsblokonderwijsvorman.aanvangsblok
})
} as :object {
class : "zuyd.MoodleCourse"
}]]></dw:set-payload>
</dw:transform-message>
and then do an http request for the first time:
<http:request config-ref="Moodle_HTTP_Request_Configuration" path="${moodle.webservice.path}" method="POST" doc:name="HTTP get_users_by_field" metadata:id="d0589922-6eeb-4171-b4a8-a4a118a8cd78">
<http:request-builder>
<http:query-param paramName="wstoken" value="${moodle.webservice.wstoken}" />
<http:query-param paramName="wsfunction" value="core_user_get_users_by_field" />
<http:query-param paramName="field" value="username" />
<http:query-param paramName="values[0]" value="test" />
<http:query-param paramName="moodlewsrestformat" value="json" />
</http:request-builder>
</http:request>
The logger runs every time. On Linux the following exception occurs. The data from the payload is not used by the http-request.
2018-06-20 15:45:58,893 [[osiris-moodle-v0.0.17].httpListenerConfig.worker.01] INFO org.mule.api.processor.LoggerMessageProcessor - test1 testmule
2018-06-20 15:45:58,920 [[osiris-moodle-v0.0.17].httpListenerConfig.worker.01] ERROR org.mule.exception.DefaultMessagingExceptionStrategy -
********************************************************************************
Message : This transformer needs a valid endpoint (java.lang.IllegalStateException)
Code : MULE_ERROR-64999
--------------------------------------------------------------------------------
Exception stack is:
1. This transformer needs a valid endpoint (java.lang.IllegalStateException)
org.mule.transport.jms.transformers.AbstractJmsTransformer:203 (null)
2. This transformer needs a valid endpoint (java.lang.IllegalStateException) (org.mule.api.transformer.TransformerException)
org.mule.transport.jms.transformers.AbstractJmsTransformer:79 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.IllegalStateException: This transformer needs a valid endpoint
at org.mule.transport.jms.transformers.AbstractJmsTransformer.getSession(AbstractJmsTransformer.java:203)
at org.mule.transport.jms.transformers.AbstractJmsTransformer.transformToMessage(AbstractJmsTransformer.java:65)
at org.mule.transport.jms.transformers.ObjectToJMSMessage.transformMessage(ObjectToJMSMessage.java:54)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
2018-06-20 15:45:58,956 [[osiris-moodle-v0.0.17].httpListenerConfig.worker.01] DEBUG org.mule.module.http.internal.HttpMessageLogger - LISTENER
HTTP/1.1 500 This transformer needs a valid endpoint (java.lang.IllegalStateException) (org.mule.api.transformer.TransformerException) (org.mule.api.transformer.TransformerException) (org.mule.api.transformer.TransformerException). Message payload is of type: MoodleCourse
Content-Length: 259
MULE_ENCODING: UTF-8
Date: Wed, 20 Jun 2018 13:45:58 GMT
Connection: close
This transformer needs a valid endpoint (java.lang.IllegalStateException) (org.mule.api.transformer.TransformerException) (org.mule.api.transformer.TransformerException) (org.mule.api.transformer.TransformerException). Message payload is of type: MoodleCourse
Does anybody now what causes this exception and why I don't get it in Anypoint Studio?

Mule batch commit Message payload is of type: RegularImmutableList

I have Mule batch commit as:
<batch:step name="Batch_Step1">
<enricher source="#[message.payload]" target="#[recordVars.accountJson]" doc:name="Message Enricher">
<json:object-to-json-transformer doc:name="Object to JSON"/>
</enricher>
<batch:set-record-variable variableName="client_id" value="#[message.payload.client_id]" doc:name="client_id"/>
<batch:commit size="10" doc:name="Batch Commit">
<sfdc:query config-ref="SFDC_Config" query="dsql:SELECT Id FROM Account WHERE Client_ID__c = '#[message.payload.client_id]'" doc:name="Account-Query"/>
<set-payload value="#[message.payload.hasNext() ? message.payload.next(): 'none']" doc:name="sfdc-data"/>
</batch:commit>
</batch:step>
If i don't put batch-commit, application works fine, but If i use batch-commit, I am getting below error message:
INFO 2015-07-29 14:19:44,636 [batch-job-clientaccount-Batch-work-manager.01] com.mulesoft.module.batch.DefaultBatchStep: Found exception processing record on step 'Batch_Step1' for job instance '86987df0-3637-11e5-81ea-0026b9eef95d' of job 'clientaccount-Batch'.
This is the first record to show this exception on this step for this job instance. Subsequent records with the same failureswill not be logged for performance and log readability reasons:
********************************************************************************
Message : Failed to invoke query. Message payload is of type: RegularImmutableList
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. com.google.common.collect.RegularImmutableList cannot be cast to java.util.Map (java.lang.ClassCastException)
org.mule.mvel2.optimizers.impl.refl.nodes.MapAccessor:42 (null)
2. cannot invoke getter: getPayload [declr.class: org.mule.el.context.MessageContext; act.class: org.mule.el.context.MessageContext] (see trace) (java.lang.RuntimeException)
org.mule.mvel2.optimizers.impl.refl.nodes.GetterAccessor:74 (null)
3. Execution of the expression "message.payload.client_id" 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)
4. Failed to invoke query. Message payload is of type: RegularImmutableList (org.mule.api.MessagingException)
org.mule.devkit.processor.DevkitBasedMessageProcessor:133 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.ClassCastException: com.google.common.collect.RegularImmutableList cannot be cast to java.util.Map
at org.mule.mvel2.optimizers.impl.refl.nodes.MapAccessor.getValue(MapAccessor.java:42)
at org.mule.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:40)
at org.mule.mvel2.optimizers.impl.refl.nodes.VariableAccessor.getValue(VariableAccessor.java:37)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
Question 2)
Not able to use recordVars inside batch commit.Getting error as:
Exception stack is:
1. No record could be found in payload or in flow variable BATCH_RECORD (java.lang.IllegalStateException)
com.mulesoft.module.batch.record.BatchUtils:56 (null)
2. [Error: No record could be found in payload or in flow variable BATCH_RECORD]
[Near : {... recordVars.client_id ....}]
^
[Line: 1, Column: 1] (org.mule.mvel2.CompileException)

Failed to invoke updateStatus. Message payload is of type: String

i just started with Mule i was creating a very simple example using twitter
i'm using mule 3.5 i started with creating New Example Project then the Hello world
now i'm using twitter and every thing looks okay when i use show user i get the Json object but when i do update status i get this error message :
Failed to invoke updateStatus. Message payload is of type: String
Here is my XML
<flow name="TwitterUserID" doc:name="TwitterUserID">
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="8081" doc:name="HTTP"
doc:description="This endpoint receives an HTTP message." />
<object-to-string-transformer doc:name="Object to String"/>
<twitter:update-status config-ref="Twitter" doc:name="Twitter" status="This is from
Mule "/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>
Error
Root Exception stack trace:
twitter4j.internal.org.json.JSONException: JSONObject["text"] not found.
at twitter4j.internal.org.json.JSONObject.get(JSONObject.java:395)
at twitter4j.internal.org.json.JSONObject.getString(JSONObject.java:509)
at twitter4j.internal.json.StatusJSONImpl.init(StatusJSONImpl.java:166)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
WARN 2014-01-27 08:57:13,406 [[hello-world].connector.http.mule.default.receiver.02]
org.apache.commons.httpclient.HttpMethodDirector: Unable to respond to any of these
challenges: {oauth=OAuth realm="https://api.twitter.com"}
ERROR 2014-01-27 08:57:13,409 [[hello-world].connector.http.mule.default.receiver.02]
org.mule.retry.notifiers.ConnectNotifier: Failed to connect/reconnect: Work Descriptor.
Root Exception was: JSONObject["text"] not found.. Type: class
twitter4j.internal.org.json.JSONException
ERROR 2014-01-27 08:57:13,412 [[hello-world].connector.http.mule.default.receiver.02]
org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Failed to invoke updateStatus. Message payload is of type:
String
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. JSONObject["text"] not found. (twitter4j.internal.org.json.JSONException)
twitter4j.internal.org.json.JSONObject:395 (null)
2. JSONObject["text"] not found. (twitter4j.TwitterException)
twitter4j.internal.json.StatusJSONImpl:172 (null)
3. Failed to invoke updateStatus. Message payload is of type: String
(org.mule.api.MessagingException)
org.mule.twitter.processors.UpdateStatusMessageProcessor:175
--------------------------------------------------------------------------------
Root Exception stack trace:
twitter4j.internal.org.json.JSONException: JSONObject["text"] not found.
at twitter4j.internal.org.json.JSONObject.get(JSONObject.java:395)
at twitter4j.internal.org.json.JSONObject.getString(JSONObject.java:509)
at twitter4j.internal.json.StatusJSONImpl.init(StatusJSONImpl.java:166)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
The issue was i needed to change the permission to read and write to the twitter application
go to application page
Settings
check :

Mule 3.3.1 CE integration with Twitter

I get the following stack trace when I run the order discounter example application from Mule Studio 1.3.2 x64 (Mule 3.3.1 CE runtime) on JDK 1.6.0_21 (32-bit) Windows 7 x64 :
INFO 2013-06-25 10:29:13,507 [[orderdiscounter].order_management.async1.02] org.mule.lifecycle.AbstractLifecycleManager: Starting connector: connector.https.mule.default
INFO 2013-06-25 10:29:13,517 [[orderdiscounter].order_management.async1.02] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer: org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest
INFO 2013-06-25 10:29:13,527 [[orderdiscounter].order_management.async1.02] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default response transformer: org.mule.transport.http.transformers.MuleMessageToHttpResponse
INFO 2013-06-25 10:29:13,527 [[orderdiscounter].order_management.async1.02] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer: org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest
INFO 2013-06-25 10:29:13,527 [[orderdiscounter].order_management.async1.02] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.https.mule.default.dispatcher.11950696'. Object is: HttpsClientMessageDispatcher
INFO 2013-06-25 10:29:13,527 [[orderdiscounter].order_management.async1.02] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.https.mule.default.dispatcher.11950696'. Object is: HttpsClientMessageDispatcher
ERROR 2013-06-25 10:29:14,047 [[orderdiscounter].order_management.async1.02] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Failed to invoke updateStatus. Message payload is of type: String
Type : org.mule.api.MessagingException
Code : MULE_ERROR--2
Payload : Order #: 1 Date: 2013.06.25 10:29:13 CDT Order total: 12300.0
JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html
********************************************************************************
Exception stack is:
1. Could not authenticate with OAuth
(twitter4j.TwitterException)
org.mule.twitter.TwitterConnector:687 (null)
2. Failed to invoke updateStatus. Message payload is of type: String (org.mule.api.MessagingException)
org.mule.twitter.processors.UpdateStatusMessageProcessor:164 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
********************************************************************************
Root Exception stack trace:
Could not authenticate with OAuth
Relevant discussions can be on the Internet at:
http://www.google.co.jp/search?q=00000000 or
http://www.google.co.jp/search?q=00000000
TwitterException{exceptionCode=[00000000-00000000], statusCode=-1, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.5}
at org.mule.twitter.TwitterConnector.updateStatus(TwitterConnector.java:687)
at org.mule.twitter.processors.UpdateStatusMessageProcessor$1.process(UpdateStatusMessageProcessor.java:153)
at org.mule.twitter.adapters.TwitterConnectorProcessAdapter$1.execute(TwitterConnectorProcessAdapter.java:36)
at org.mule.twitter.processors.UpdateStatusMessageProcessor.process(UpdateStatusMessageProcessor.java:139)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:43)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:43)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)
at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:118)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:186)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:179)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:20)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:34)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:18)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:58)
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:48)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54)
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:44)
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:44)
at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:52)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:113)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:34)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:178)
at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:43)
at org.mule.work.WorkerContext.run(WorkerContext.java:311)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Can you help me troubleshoot this ? I have setup the twitter account for read-write access and have provided the values for consumerKey, consumerSecret, accessToken and accessTokenSecret as per the mulesoft documentation.
TIA
This seems to have been fixed by moving to Mule 3.4 CE x64. However, what went wrong with 3.3.1 CE is unknown.