Announcement Announcement Module
Collapse
No announcement yet.
Problem with multiResourceItemReader Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with multiResourceItemReader

    Hi,

    i am reading a file and once done it is moved to archive dir, But the MultiResourceItemReader is again looking for the same old file and it is giving following exception.

    2010-05-27 12:25:00,046 [SimpleAsyncTaskExecutor-2] ERROR org.springframework.batch.core.step.AbstractStep - Encountered an error executing the step: class org.springframework.batch.item.ItemStreamException : Failed to initialize the reader
    org.springframework.batch.item.ItemStreamException : Failed to initialize the reader
    at org.springframework.batch.item.support.AbstractIte mCountingItemStreamItemReader.open(AbstractItemCou ntingItemStreamItemReader.java:111)
    at org.springframework.batch.item.file.MultiResourceI temReader.open(MultiResourceItemReader.java:154)
    at org.springframework.batch.item.support.CompositeIt emStream.open(CompositeItemStream.java:98)
    at org.springframework.batch.core.step.item.ChunkMoni tor.open(ChunkMonitor.java:106)
    at org.springframework.batch.item.support.CompositeIt emStream.open(CompositeItemStream.java:98)
    at org.springframework.batch.core.step.tasklet.Taskle tStep.open(TaskletStep.java:364)
    at org.springframework.batch.core.step.AbstractStep.e xecute(AbstractStep.java:194)
    at org.springframework.batch.core.job.AbstractJob.han dleStep(AbstractJob.java:348)
    at org.springframework.batch.core.job.flow.FlowJob.ac cess$100(FlowJob.java:43)
    at org.springframework.batch.core.job.flow.FlowJob$Jo bFlowExecutor.executeStep(FlowJob.java:137)
    at org.springframework.batch.core.job.flow.support.st ate.StepState.handle(StepState.java:60)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.resume(SimpleFlow.java:144)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.start(SimpleFlow.java:124)
    at org.springframework.batch.core.job.flow.FlowJob.do Execute(FlowJob.java:105)
    at org.springframework.batch.core.job.AbstractJob.exe cute(AbstractJob.java:250)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:110)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.IllegalStateException: Input resource must exist (reader is in 'strict' mode): file [D:\tempWork\gas\DET_RT1_with2records.DET]
    at org.springframework.batch.item.file.FlatFileItemRe ader.doOpen(FlatFileItemReader.java:245)
    at org.springframework.batch.item.support.AbstractIte mCountingItemStreamItemReader.open(AbstractItemCou ntingItemStreamItemReader.java:108)
    ... 16 more

    and the Config is....
    <tasklet>
    <chunk reader="itemReader" writer="itemWriter" commit-interval="1" skip-limit="10">
    </chunk>
    <listeners>
    <listener ref="resourceListener"/>
    </listeners>
    </tasklet>
    <beans:bean id="resourceListener" class="com.systrends.gas.listeners.MultiResourceLi stener">
    <property name="directory" value="${job.flatFileReadJob.input.queuedir}" />
    <property name="multiResourceItemReader" ref="itemReader" />
    <property name="extensionFilter" value="DET" />
    </beans:bean>
    <beans:bean id="itemReader" class="org.springframework.batch.item.file.MultiRe sourceItemReader">
    <property name="resources" value="file://${job.flatFileReadJob.input.queuedir}/*DET*.*"/>
    <property name="delegate" ref="flatFileReader" />
    </beans:bean>
Working...
X