Reputation: 1103
I got error while 0 records with split ..With one record or multiple records it work fine But if there are no records with split then it gives error I got this error
org.mule.api.MessagingException: Object "java.lang.String" not of correct type. It must be of type "{interface java.lang.Iterable,interface java.util.Iterator,interface org.mule.routing.MessageSequence,interface java.util.Collection}" (java.lang.IllegalArgumentException) (com.mulesoft.module.batch.exception.BatchException). Message payload is of type: String at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:32) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:107) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:88) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:80)
My flow is as follow
<batch:job name="testBatch">
<batch:input>
<component class="org.test.d1.Find" doc:name="Java"/>
<file:outbound-endpoint path="test" outputPattern="test.xml" responseTimeout="10000" doc:name="File"/>
<logger message="COUNT -> #[xpath('fn:count(//po:Account)')]" level="INFO" doc:name="Logger"/>
<expression-filter expression="#[xpath('fn:count(//po:Account)')!=0.0]" doc:name="Expression"/>
<splitter evaluator="xpath" expression="//po:Account" doc:name="Splitter"/>
<collection-aggregator failOnTimeout="true" doc:name="Collection Aggregator"/>
</batch:input>
<batch:process-records>
<batch:step name="Batch_Step">
</batch:step>
</batch:process-records>
<batch:on-complete>
<logger level="INFO" doc:name="Logger"/>
<set-payload value="Total Record : #[payload.totalRecords] fail Records : #[payload.failedRecords] successfull records :#[payload.successfulRecords +'\n'] " doc:name="Set Payload"/>
</batch:on-complete>
</batch:job>
Please help me to resolve this error. Thanks
Upvotes: 0
Views: 285
Reputation: 111
the exception it self says you are getting a String as input to the splitter component which is causing the issue.
make sure you are giving an iterateable object to splitter component.
Upvotes: 0