Mule is throwing error: No namespace on "someElement" element - mule

I provided snippet of my code that should work normally but it doesn't.
In short, my flow is triggered by quartz, read some data from database, loop through results, on each loop do something and then finish.
Everything works ok when result from service (http outbound) return that there is nothing to give back, but when choice (in flow) is not default it redirect to sub-flow where xslt perform and save file. File saves like it should (I checked with external tools if xml suits criteria) and logger prints out number 3 as proof that it is finished (couple of lines before error is thrown) but after that I get error given below. Anyone knows why? I am out of ideas.
My flow:
<flow name="msp2bassGettingContent" doc:name="Starter">
<quartz:inbound-endpoint responseTimeout="10000" doc:name="Quartz" jobName="Starter" repeatInterval="600000" startDelay="3000">
<quartz:event-generator-job groupName="Generator" jobGroupName="Generator">
<quartz:payload file="${prop.requestEvent}"/>
</quartz:event-generator-job>
</quartz:inbound-endpoint>
<jdbc:outbound-endpoint exchange-pattern="request-response" queryKey="getUnreadedRoutes" queryTimeout="-1" connector-ref="JDBCConnector" doc:name="GetNulls">
<jdbc:query key="getUnreadedRoutes" value="SELECT routeid FROM kptemp WHERE readed IS NULL"/>
</jdbc:outbound-endpoint>
<foreach collection="#[message.payload]" doc:name="For Each" counterVariableName="counter123">
<flow-ref name="msp2bass" doc:name="Flow Reference"/>
</foreach>
</flow>
<sub-flow name="msp2bass" doc:name="msp2bassGetEvent">
<set-variable variableName="routeid" value="#[payload['routeid']]" doc:name="Variable"/>
<set-payload value="<a/>;" doc:name="Set Payload"/>
<mulexml:object-to-xml-transformer doc:name="Object to XML"/>
<mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" xsl-file="${prop.createRequest}" doc:name="XSLT" ignoreBadInput="true">
<mulexml:context-property key="customerId" value="${prop.customerId}"/>
<mulexml:context-property key="siteName" value="${prop.siteName}"/>
<mulexml:context-property key="routeID" value="#[routeid]"/>
</mulexml:xslt-transformer>
<cxf:proxy-client payload="body" doc:name="SOAP">
<cxf:outInterceptors>
<spring:ref bean="WSS4JOutInterceptorBean"/>
</cxf:outInterceptors>
</cxf:proxy-client>
<https:outbound-endpoint exchange-pattern="request-response" host="${prop.host}" port="${prop.port}" path="${prop.path}" method="POST" connector-ref="HTTP_HTTPS1" doc:name="HTTP"/>
<byte-array-to-object-transformer doc:name="Byte Array to Object"/>
<choice doc:name="Choice">
<when expression="#[xpath('boolean(//soap:Envelope/soap:Body/ns2:processComplexResponse/MSPResponse/serviceEvents/measurements/name)')]">
<flow-ref name="transform" doc:name="Flow Reference"/>
</when>
<otherwise>
<logger message="Not null: #[routeid]" level="INFO" doc:name="Logger"/>
</otherwise>
</choice>
</sub-flow>
<sub-flow name="transform" doc:name="transform">
<logger message="Payload: #[payload]" level="INFO" doc:name="Logger"/>
<mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" xsl-file="${prop.transformer}" doc:name="XSLT"/>
<file:outbound-endpoint path="./work" outputPattern="#[routeid].xml" responseTimeout="10000" disableTransportTransformer="true" doc:name="File"/>
<logger message="3" level="INFO" doc:name="3"/>
</sub-flow>
Stack trace:
INFO 2014-01-22 12:30:21,999 [[bass2msp].msp2bassGettingContent.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Not null: IR_1389972193818
INFO 2014-01-22 12:30:22,252 [[bass2msp].msp2bassGettingContent.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Payload: SOME XML CONTENT
INFO 2014-01-22 12:30:22,301 [[bass2msp].msp2bassGettingContent.stage1.02] org.mule.api.processor.LoggerMessageProcessor: 3
WARN 2014-01-22 12:17:56,335 [[bass2msp].msp2bassGettingContent.stage1.04] org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://support.cxf.module.mule.org/}ProxyService#{http://support.cxf.module.mule.org/}invoke has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: No namespace on "rootNode" element.
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.readVersion(ReadHeadersInterceptor.java:109)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:141)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:60)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:799)
at org.mule.module.cxf.transport.MuleUniversalConduit.dispatchMuleMessage(MuleUniversalConduit.java:280)
at org.mule.module.cxf.transport.MuleUniversalConduit$2.handleMessage(MuleUniversalConduit.java:194)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:533)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:375)
at org.mule.module.cxf.CxfOutboundMessageProcessor.doSendWithClient(CxfOutboundMessageProcessor.java:235)
at org.mule.module.cxf.CxfOutboundMessageProcessor.process(CxfOutboundMessageProcessor.java:125)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:54)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:26)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:70)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:65)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:106)
at org.mule.routing.outbound.AbstractMessageSequenceSplitter.processParts(AbstractMessageSequenceSplitter.java:133)
at org.mule.routing.outbound.AbstractMessageSequenceSplitter.process(AbstractMessageSequenceSplitter.java:63)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:54)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:26)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:70)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:65)
at org.mule.routing.Foreach.process(Foreach.java:95)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:106)
at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:122)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:192)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:185)
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:184)
at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:43)
at org.mule.work.WorkerContext.run(WorkerContext.java:311)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
ERROR 2014-01-22 12:17:56,340 [[bass2msp].msp2bassGettingContent.stage1.04] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : No namespace on "rootNode" element.. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: PostMethod
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. No namespace on "rootNode" element. (org.apache.cxf.binding.soap.SoapFault)
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor:109 (null)
2. No namespace on "rootNode" element.. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: PostMethod (org.mule.api.transport.DispatchException)
org.mule.module.cxf.CxfOutboundMessageProcessor:144 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.apache.cxf.binding.soap.SoapFault: No namespace on "rootNode" element.
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.readVersion(ReadHeadersInterceptor.java:109)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:141)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:60)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
Any help is appreciated! Thank you!
EDIT.1
I did some more research and I found out that problem is when call to subflow in my loop (for each) end. I have put logger after flow-ref and it printed ok till that error (file at the end of flow is generated but logger is quiet). So, is this known/unknown bug or something? Or do I somehow rewrite collection that is looping here: message.payload so that looper cannot read next value? But then, why logger after flow-ref doesn't get triggered inside loop at the end?

The cxf:proxy-client element is a "two way" element, i.e. it deals with the message both in request and response phases.
The "transform" sub-flow affects the message payload, which was the response from the HTTP endpoint, with an XSL-T. This confuses the cxf:proxy-client element when it eventually gets the response back flowing through it.
One potential fix is to ref the sub-flow in an async block so whatever payload transformation it will do won't be visible to the calling flow, but this will change the response of "msp2bass".
Another option would consist in putting the byte-array-to-object-transformer and choice elements in a response block above the cxf:proxy-client, that way you would affect the response after CFX so it would stop complaining.

Related

what is wrong with Jersey class in below Mule flow?

In the following mule flow, I have implemented Jersey class for REST web service with VM endpoints.
<flow name="APIKeyLoadFlow" doc:name="APIKeyLoadFlow"
initialState="started">
<http:inbound-endpoint exchange-pattern="request-response"
address="${api.load.invoke.url}" doc:name="HTTP"
responseTimeout="${apikey.http.responsetimeout}" />
<logger message="Start Of APIKeyLoadFlow -#[payload]" level="INFO"
doc:name="ENTRY_LOG" />
<request-reply timeout="300000" >
<vm:outbound-endpoint connector-ref="VM_Connector"
exchange-pattern="one-way" path="APIKeyLoadRequest">
</vm:outbound-endpoint>
<vm:inbound-endpoint connector-ref="VM_Connector"
exchange-pattern="one-way" path="APIKeyLoadResponse">
</vm:inbound-endpoint>
</request-reply>
<logger message="End of APIKeyLoadFlow" level="INFO" doc:name="EXIT_LOG" />
<catch-exception-strategy doc:name="Catch Exception Strategy">
<logger level="WARN" doc:name="Exception_Log"
message="Exception in ApiKeyFlow #[System.getProperty('line.separator')] Error Description = #[exception.getMessage()]" />
</catch-exception-strategy>
</flow>
<flow name="ApiKeyLoadRestServiceFlow" doc:name="ApiKeyLoadRestServiceFlow">
<vm:inbound-endpoint exchange-pattern="one-way"
path="APIKeyLoadRequest" doc:name="APIKey_Load_Request">
</vm:inbound-endpoint>
<logger message="Start of ApiKeyLoadRestServiceFlow -#[payload]" level="INFO"
doc:name="ENTRY_LOG" />
<jersey:resources doc:name="REST">
<component class="com.elexon.bmrs.apikey.service.impl.ApiKeyLoadImpl" />
</jersey:resources>
<logger message="End of ApiKeyLoadRestServiceFlow" level="INFO"
doc:name="EXIT_LOG" />
<vm:outbound-endpoint exchange-pattern="one-way"
path="APIKeyLoadResponse" doc:name="APIKey_Load_Response">
</vm:outbound-endpoint>
But i am getting below exception while running the request? Kindly let me what is the issue in the implemented flow?
INFO 2015-12-08 13:09:59,792 [[apikey_load_phase3].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: Start Of APIKeyLoadFlow -org.apache.commons.httpclient.ContentLengthInputStream#1517f14
INFO 2015-12-08 13:09:59,813 [[apikey_load_phase3].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'VM_Connector.dispatcher.25489136'. Object is: VMMessageDispatcher
INFO 2015-12-08 13:09:59,813 [[apikey_load_phase3].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'VM_Connector.dispatcher.25489136'. Object is: VMMessageDispatcher
INFO 2015-12-08 13:09:59,830 [[apikey_load_phase3].ApiKeyLoadRestServiceFlow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Start of ApiKeyLoadRestServiceFlow -org.apache.commons.httpclient.ContentLengthInputStream#1517f14
ERROR 2015-12-08 13:09:59,833 [[apikey_load_phase3].ApiKeyLoadRestServiceFlow.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy:
Message : Failed to invoke JerseyResourcesComponent{ApiKeyLoadRestServiceFlow.component.14630019}. Component that caused exception is: JerseyResourcesComponent{ApiKeyLoadRestServiceFlow.component.14630019}. Message payload is of type: ContentLengthInputStream
Code : MULE_ERROR--2
Exception stack is:
1. null (java.lang.NullPointerException)
org.mule.module.jersey.JerseyResourcesComponent:116 (null)
2. Failed to invoke JerseyResourcesComponent{ApiKeyLoadRestServiceFlow.component.14630019}. Component that caused exception is: JerseyResourcesComponent{ApiKeyLoadRestServiceFlow.component.14630019}. Message payload is of type: ContentLengthInputStream (org.mule.component.ComponentException)
org.mule.component.AbstractComponent:144 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/component/ComponentException.html)
Root Exception stack trace:
java.lang.NullPointerException
at org.mule.module.jersey.JerseyResourcesComponent.doInvoke(JerseyResourcesComponent.java:116)
at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:122)
at org.mule.component.AbstractComponent.access$000(AbstractComponent.java:57)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
The Jersey component needs to be bound to an http endpoint, so not sure it can work behind a VM endpoint as all the http header and request information will be lost when passing a transport barrier etc. You could try copying the headers from inbound to outbound before the vm call, but still not sure this will work.

Scatter gather routing error. Message payload is of type: String

I'm new to Mule and while working on a fairly simple Hello World example on Anypoint Studio to test out the Scatter/Gather flow control element, I'm getting the following error, without much else in the way of information:
ERROR 2014-12-19 22:00:30,172 [[unifinesb].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Exception was found for route(s): 0. Message payload is of type: String
Type : org.mule.routing.CompositeRoutingException
Code : MULE_ERROR--2
JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/routing/CompositeRoutingException.html
Payload : /Waldo
********************************************************************************
Exception stack is:
1. Exception was found for route(s): 0. Message payload is of type: String (org.mule.routing.CompositeRoutingException)
org.mule.routing.CollectAllAggregationStrategy:51 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/routing/CompositeRoutingException.html)
********************************************************************************
Root Exception stack trace:
org.mule.routing.CompositeRoutingException: Exception was found for route(s): 0. Message payload is of type: String
at org.mule.routing.CollectAllAggregationStrategy.aggregateWithFailedRoutes(CollectAllAggregationStrategy.java:51)
at org.mule.routing.CollectAllAggregationStrategy.aggregate(CollectAllAggregationStrategy.java:38)
at org.mule.routing.ScatterGatherRouter.processResponses(ScatterGatherRouter.java:207)
at org.mule.routing.ScatterGatherRouter.process(ScatterGatherRouter.java:135)
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.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at ...
Judging from the top description of the error, I understand the problem to be that Scatter gather does not receive String payloads, even though the current documentation for the component mentions nothing of the sort. Is this correct?
The flow I'm running is fairly simple, receiving a String from an inbound http and trying to route it to a REST service that will use the String to print something (returning text/plain) and to a DB to store the String in a table. Relevant code follows:
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8084" doc:name="HTTP"/>
<expression-filter expression="#[payload != '/favicon.ico']" doc:name="Filter browser icon padding"/>
<logger message="current payload is #[payload]" level="INFO" doc:name="Startup log - to stdout"/>
<scatter-gather doc:name="Scatter-Gather">
<processor-chain>
<logger message="#['Rest branch msg input :' + payload]" level="DEBUG" doc:name="File Logger"/>
<http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8080/application/rest/mensaje?givenName=#[payload]" doc:name="REST Service"/>
<logger message="#['Rest msg output :' + payload]" level="DEBUG" doc:name="File Logger"/>
</processor-chain>
<processor-chain>
<logger message="#['Database msg input :' + payload]" level="DEBUG" doc:name="File Logger"/>
<db:insert config-ref="MySQL_VestaLocal" doc:name="Application Postgress">
<db:parameterized-query><![CDATA[insert into http_user_info (first_name) values ('#[payload]');]]></db:parameterized-query>
</db:insert>
<logger message="#['Database msg output :' + payload]" level="DEBUG" doc:name="File Logger"/>
</processor-chain>
</scatter-gather>
<set-payload value="#['REST DB Success!']" doc:name="Set Payload"/>
Trawling through the net I found this old Mule JIRA issue with an exception similar to what I'm getting, but trying out the suggested solution (workaround?) didn't do anything for me: https://www.mulesoft.org/jira/browse/MULE-7594
Something wrong is happening in your route 0.
You are getting a composite routing exception as per documentation:
The CompositeRoutingException is new to the 3.5.0 Runtime. It extends
the Mule MessagingException to aggregate exceptions from different
routes in the context of a single message router. Exceptions are
correlated to each route through a sequential ID.
This exception exposes two methods which allow you to obtain the IDs
of failed routes and the exceptions returned by each route.
The getExceptions method returns a map where the key is an integer
that identifies the index of the failed route, and the value is the
exception itself. The getExceptionForRouteIndex(int) method returns
the exception of the requested route ID.
As you don't have an execption strategy, the toString is call to that exception and that only prints the route failing (that has nothing to do with the fact that the payload is String)
Please use the following exeption strategy to find out exactly what's wrong:
<catch-exception-strategy doc:name="Catch Exception Strategy">
<logger level="ERROR" message="#[exception.exceptions]"/>
</catch-exception-strategy>

to store a message in rabbitmq from mule

Below is my flow and i'm trying to store my salesforce batch information into a queue in rabbit mq
<flow name="foreachsimilar_pmFlow1" doc:name="foreachsimilar_pmFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<sfdc:create-job config-ref="Salesforce1" type="HRISASI__c" operation="insert" doc:name="Salesforce"/>
<set-variable variableName="batchID" value="1" doc:name="Variable"/>
<set-property propertyName="jobInfo" value="#[payload]" doc:name="Property"/>
<set-variable variableName="jobId" value="#[payload.id]" doc:name="Variable"/>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="id" queryTimeout="-1" connector-ref="Database1" doc:name="Database"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<scripting:transformer doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[payload.collect { it.EmpId }.collate(3).collect { [min: it[0], max: it[-1]] }
]]></scripting:script>
</scripting:transformer>
<foreach doc:name="For Each">
<set-variable variableName="bulkPayload" value="#[groovy: return[];]" doc:name="bulkPayload EmptyArray"/>
<set-variable variableName="IDs" value="#[groovy:return[];]" doc:name="Id EmptyArray"/>
<set-variable variableName="jdbdinsbatch" value="#[groovy: return[];]" doc:name="Variable"/>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryTimeout="-1" connector-ref="Database1" doc:name="Database" queryKey="all"/>
<foreach doc:name="For Each">
<set-variable variableName="empId" value="#[payload['EmpId']]" doc:name="Variable"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<data-mapper:transform config-ref="map_to_hrisasi__c" doc:name="Map To HRISASI__c"/>
<scripting:transformer doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[payloadMap = payload[0];
IDs = flowVars['IDs'];
IDs.add( [ EmpId: flowVars['EmpId'] ] );
flowVars['IDs'] = IDs;
jdbdinsbatch= flowVars['jdbdinsbatch'];
jdbdinsbatch.add( [ EmpId: flowVars['EmpId'], batchID: flowVars['batchID'] ] );
flowVars['jdbdinsbatch'] = jdbdinsbatch;
return [ payloadMap ];]]></scripting:script>
</scripting:transformer>
<set-variable variableName="bulkPayload" value="#[groovy: bulkPayload = flowVars['bulkPayload']; bulkPayload.add(payload[0]); return bulkPayload;]" doc:name="bulkPayload"/>
</foreach>
<set-payload value="#[flowVars['bulkPayload']]" doc:name="Set Payload"/>
<sfdc:create-batch config-ref="Salesforce1" doc:name="Salesforce">
<sfdc:job-info ref="#[message.outboundProperties['jobInfo']]"/>
<sfdc:objects ref="#[payload]"/>
</sfdc:create-batch>
<scripting:transformer doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[return [ batch: payload, IDs: flowVars['IDs'], batchid: flowVars['batchID'] ]]]></scripting:script>
</scripting:transformer>
<amqp:outbound-endpoint exchangeName="Salesforce-Batch" queueName="batchInfo" exchangeDurable="true" queueDurable="true" responseTimeout="10000" doc:name="AMQP"/>
</foreach>
<flow-ref name="foreachsimilar_pmFlow2" doc:name="Flow Reference"/>
</flow>
The below exception is thrown
Message : Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=amqp://Salesforce-Batch/amqp-queue.batchInfo, connector=AmqpConnector
{
name=AMQP_Connector
lifecycle=start
this=33982399
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[amqp]
serviceOverrides=<none>
}
, name='endpoint.amqp.Salesforce.Batch.amqp.queue.batchInfo', mep=ONE_WAY, properties={queueDurable=true, exchangeDurable=true}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: AmqpMessage
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. invalid value in table (java.lang.IllegalArgumentException)
com.rabbitmq.client.impl.Frame:306 (null)
2. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=amqp://Salesforce-Batch/amqp-queue.batchInfo, connector=AmqpConnector
{
name=AMQP_Connector
lifecycle=start
this=33982399
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[amqp]
serviceOverrides=<none>
}
, name='endpoint.amqp.Salesforce.Batch.amqp.queue.batchInfo', mep=ONE_WAY, properties={queueDurable=true, exchangeDurable=true}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: AmqpMessage (org.mule.api.transport.DispatchException)
org.mule.transport.AbstractMessageDispatcher:109 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.IllegalArgumentException: invalid value in table
at com.rabbitmq.client.impl.Frame.fieldValueSize(Frame.java:306)
at com.rabbitmq.client.impl.Frame.tableSize(Frame.java:246)
at com.rabbitmq.client.impl.ValueWriter.writeTable(ValueWriter.java:120)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
Could somebody please tell as why is the above exception thrown and what should be done to resolve it struck with this for the past two days
Thank you in advance.
below is the stack trace after enabling verbose exception logging
********************************************************************************
Root Exception stack trace:
java.lang.IllegalArgumentException: invalid value in table
at com.rabbitmq.client.impl.Frame.fieldValueSize(Frame.java:306)
at com.rabbitmq.client.impl.Frame.tableSize(Frame.java:246)
at com.rabbitmq.client.impl.ValueWriter.writeTable(ValueWriter.java:120)
at com.rabbitmq.client.impl.ContentHeaderPropertyWriter.writeTable(ContentHeaderPropertyWriter.java:98)
at com.rabbitmq.client.AMQP$BasicProperties.writePropertiesTo(AMQP.java:1782)
at com.rabbitmq.client.impl.AMQContentHeader.writeTo(AMQContentHeader.java:51)
at com.rabbitmq.client.impl.AMQContentHeader.toFrame(AMQContentHeader.java:78)
at com.rabbitmq.client.impl.AMQCommand.transmit(AMQCommand.java:106)
at com.rabbitmq.client.impl.AMQChannel.quiescingTransmit(AMQChannel.java:316)
at com.rabbitmq.client.impl.AMQChannel.transmit(AMQChannel.java:292)
at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:636)
at org.mule.transport.amqp.AmqpMessageDispatcher$OutboundAction$1.run(AmqpMessageDispatcher.java:55)
at org.mule.transport.amqp.AmqpMessageDispatcher.doOutboundAction(AmqpMessageDispatcher.java:172)
at org.mule.transport.amqp.AmqpMessageDispatcher.doDispatch(AmqpMessageDispatcher.java:127)
at org.mule.transport.AbstractMessageDispatcher.process(AbstractMessageDispatcher.java:99)
at org.mule.transport.AbstractConnector$DispatcherMessageProcessor.process(AbstractConnector.java:2627)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:101)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.endpoint.outbound.OutboundResponsePropertiesMessageProcessor.process(OutboundResponsePropertiesMessageProcessor.java:39)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.EndpointTransactionalInterceptingMessageProcessor$1.process(EndpointTransactionalInterceptingMessageProcessor.java:50)
at org.mule.processor.EndpointTransactionalInterceptingMessageProcessor$1.process(EndpointTransactionalInterceptingMessageProcessor.java:47)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:20)
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(I...
********************************************************************************
The payload you're trying to send to Rabbit looks quite complex (sfdc BatchInfo object). How do you except it to be readable for the queue consumer? I think that, for some reason, the message transformers involved in transforming this payload to a byte array suited for AMQP transport fails and you end up trying to send the groovy generated Map with an sfdc BatchInfo object as is to the AMQP client lib.
You should convert the map with contents to a string before sending it to Rabbit.
Something like this (call toString on the BatchInfo object and then convert the map to JSON):
Edited (removed outbound properties)
<scripting:transformer doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[return [ batch: payload.toString(), IDs: flowVars['IDs'], batchid: flowVars['batchID'] ]]]></scripting:script>
</scripting:transformer>
<json:object-to-json-transformer doc:name="Object to JSON"/>
<amqp:outbound-endpoint exchangeName="Salesforce-Batch" queueName="batchInfo" exchangeDurable="true" queueDurable="true" responseTimeout="10000" doc:name="AMQP">
<message-properties-transformer scope="outbound">
<delete-message-property key="*" />
</message-properties-transformer>
</amqp:outbound-endpoint>

mule Missing ContentType

I need to design a Mule flow with xml file as input to a JMS queue. Once in queue it will be picked up to hit a SOAP web service. Following is a code.
<jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
<flow name="jmsFlow2" doc:name="jmsFlow2">
<file:inbound-endpoint responseTimeout="10000" doc:name="File" path="D:\Input"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<jms:outbound-endpoint queue="DimQueue" connector-ref="Active_MQ" doc:name="JMS" mimeType="text/plain"/>
</flow>
<flow name="jmsFlow1" doc:name="jmsFlow1">
<jms:inbound-endpoint queue="DimQueue" connector-ref="Active_MQ" doc:name="JMS"/>
<jms:jmsmessage-to-object-transformer doc:name="JMSMessage to Object"/>
<logger message="#[message.payload]" level="INFO" doc:name="Logger"/>
<!-- <mulexml:object-to-xml-transformer doc:name="Object to XML"/> -->
<logger message="#[message.payload]" level="INFO" doc:name="Logger"/>
<set-property propertyName="Content-Type" value="application/soap+xml" doc:name="Property"/>
<logger message="#[message.outboundProperties]-------#[header:Content-Type]" level="INFO" doc:name="Logger"/>
<cxf:jaxws-service serviceClass="com.org.ProcessImpl" doc:name="SOAP" enableMuleSoapHeaders="false" mtomEnabled="true">
</cxf:jaxws-service>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="9090" method="POST" doc:name="HTTP">
</http:outbound-endpoint>
</flow>
It gives following error:
WARN 2014-02-06 15:27:23,145 [[jms].jmsFlow1.stage1.02]org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://com.capgemini/cif/dim}ProcessActivityService has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: Missing ContentType.
at org.apache.cxf.binding.soap.jms.interceptor.SoapFaultFactory.createSoap11Fault(SoapFaultFactory.java:58)
at org.apache.cxf.binding.soap.jms.interceptor.SoapFaultFactory.createFault(SoapFaultFactory.java:48)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.createFault(SoapJMSInInterceptor.java:226)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.checkContentType(SoapJMSInInterceptor.java:191)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.handleMessage(SoapJMSInInterceptor.java:49)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.handleMessage(SoapJMSInInterceptor.java:38)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)
at org.mule.module.cxf.CxfInboundMessageProcessor.sendToDestination(CxfInboundMessageProcessor.java:320)
at org.mule.module.cxf.CxfInboundMessageProcessor.process(CxfInboundMessageProcessor.java:142)
at org.mule.module.cxf.config.FlowConfiguringMessageProcessor.process(FlowConfiguringMessageProcessor.java:52)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:106)
at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:122)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:192)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:185)
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:184)
at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:43)
at org.mule.work.WorkerContext.run(WorkerContext.java:311)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.cxf.binding.soap.jms.interceptor.JMSFault: Missing ContentType.
at org.apache.cxf.binding.soap.jms.interceptor.JMSFaultFactory.createFault(JMSFaultFactory.java:111)
at org.apache.cxf.binding.soap.jms.interceptor.JMSFaultFactory.createMissingContentTypeFault(JMSFaultFactory.java:72)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.checkContentType(SoapJMSInInterceptor.java:188)
... 38 more
The loggers in the code give correct Content-Type but still the error persists.
Can anyone help?
Thanks in advance
Your issue with the Content-Type could be due to old version, as I can not reproduce it.
However, if you want to use xml data to call SOAP web service, I think your approach is incorrect. You should use a proxy client, instead. Something like this:
<jms:inbound-endpoint queue="DimQueue" connector-ref="Active_MQ" doc:name="JMS"/>
<set-property propertyName="Content-Type" value="application/soap+xml" doc:name="Property"/>
<set-property propertyName="SOAPAction" value="urn:#myMethod" doc:name="Property"/>
<cxf:proxy-client payload="envelope" doc:name="SOAP"/>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="9090" method="POST" doc:name="HTTP">
</http:outbound-endpoint>

Mule ESB: Object not of Correct Type Error when searching XML using XPATH

David,
Sending you my configuration again, appreciate your inputs in advance:
<flow name="IntegrationFlow" doc:name="IntegrationFlow">
<jdbc-ee:inbound-endpoint queryTimeout="-1" doc:name="Database" connector-ref="jdbcConnector" queryKey="selectAll" pollingFrequency="10000">
<jdbc-ee:transaction action="NONE"/>
</jdbc-ee:inbound-endpoint>
<logger message="************Payload is #[message.payload]*************" level="INFO" doc:name="Logger"/>
<logger message="************Payload is #[message.payload.destination]*************" level="INFO" doc:name="Logger"/>
<logger message="************Payload is #[message.payload.price]*************" level="INFO" doc:name="Logger"/>
<foreach doc:name="Foreach">
<choice doc:name="Choice">
<when expression="#[message.payload.price > 750]">
<!-- <when expression="#[message.payload.price > 750]"> -->
<processor-chain doc:name="Processor Chain">
<jdbc-ee:maps-to-xml-transformer doc:name="Maps to XML"/>
<jms:outbound-endpoint queue="queue1" connector-ref="jmsConnector" doc:name="JMS"/>
</processor-chain>
</when>
<otherwise>
<custom-transformer returnClass="java.util.List" class="org.mule.confluex.java.MapToListTransformer" doc:name="Java"/>
<logger message="Payload is #[message.payload]" level="INFO" doc:name="Logger1"/>
<jdbc-ee:maps-to-csv-transformer mimeType="text/plain" delimiter="," mappingFile="C:\Downloads\Temp\mapping.xml" doc:name="Maps to CSV"/>
<logger message="CSV Payload is #[message.payload]" level="INFO" doc:name="Logger2"/>
<file:outbound-endpoint path="C:\Downloads\toAmazon" responseTimeout="10000" mimeType="text/plain" connector-ref="fileConnector" doc:name="File"/>
<s3:create-object config-ref="Amazon_S3" bucketName="confluexdemo" contentType="text/plain" key="*.*" doc:name="Amazon S3"/>
</otherwise>
</choice>
</foreach>
</flow>
Here is the Run Log:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Started app 'ConfluexDemo' +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2013-11-24 19:18:32,563 [[ConfluexDemo].IntegrationFlow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: ************Payload is {DESTINATION=SFO, PRICE=300, ID=0}*************
INFO 2013-11-24 19:18:32,563 [[ConfluexDemo].IntegrationFlow.stage1.03] org.mule.api.processor.LoggerMessageProcessor: ************Payload is {DESTINATION=MLT, PRICE=1200, ID=1}*************
INFO 2013-11-24 19:18:32,611 [[ConfluexDemo].IntegrationFlow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: ************Payload is SFO*************
INFO 2013-11-24 19:18:32,611 [[ConfluexDemo].IntegrationFlow.stage1.03] org.mule.api.processor.LoggerMessageProcessor: ************Payload is MLT*************
INFO 2013-11-24 19:18:32,658 [[ConfluexDemo].IntegrationFlow.stage1.03] org.mule.api.processor.LoggerMessageProcessor: ************Payload is 1200*************
INFO 2013-11-24 19:18:32,658 [[ConfluexDemo].IntegrationFlow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: ************Payload is 300*************
ERROR 2013-11-24 19:18:32,704 [[ConfluexDemo].IntegrationFlow.stage1.03] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Execution of the expression "message.payload.price > 750" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: String
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. [Error: could not access: price; in class: java.lang.String]
[Near : {... message.payload.price > 750 ....}]
^
[Line: 1, Column: 1] (org.mvel2.PropertyAccessException)
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer:690 (null)
2. Execution of the expression "message.payload.price > 750" failed. (org.mule.api.expression.ExpressionRuntimeException)
org.mule.el.mvel.MVELExpressionLanguage:213 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html)
3. Execution of the expression "message.payload.price > 750" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: String (org.mule.api.MessagingException)
org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:35 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
[Error: could not access: price; in class: java.lang.String]
[Near : {... message.payload.price > 750 ....}]
^
[Line: 1, Column: 1]
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:690)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanPropertyAO(ReflectiveAccessorOptimizer.java:472)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:374)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
From my perspective it looks like it is a Map Payload when I print it out, it seemingly seems to read a string when I hit the 'when expression. Hopefully this should give the complete picture. Please let me know if anything else is needed.
For the sake of completion I am also including the JDBC definition:
<spring:beans>
<spring:bean id="SetupDatabaseNotificationListener" class="org.mule.confluex.database.SetupDatabaseNotificationListener"></spring:bean>
<spring:bean id="jdbcDataSource" class="org.enhydra.jdbc.standard.StandardDataSource" destroy-method="shutdown">
<spring:property name="driverName" value="org.apache.derby.jdbc.EmbeddedDriver"></spring:property>
<spring:property name="url" value="jdbc:derby:memory:muleEmbeddedDB;create=true"></spring:property>
</spring:bean>
</spring:beans>
<notifications>
<notification event="CONTEXT"></notification>
<notification-listener ref="SetupDatabaseNotificationListener"></notification-listener>
</notifications>
<jdbc-ee:connector name="jdbcConnector" pollingFrequency="10000" dataSource-ref="jdbcDataSource" doc:name="Database" queryTimeout="-1" transactionPerMessage="false" validateConnections="true">
<jdbc-ee:query key="selectAll" value="Select * from PriceTickets"></jdbc-ee:query>
</jdbc-ee:connector>
With Regards
S
The error is clear: you are passing a String to the foreach processor instead of something that can be iterated (Iterator, Collection, etc.).