Hi,
We have a situation where we keep having
java.lang.IllegalStateException: Input resource must exist (reader is in 'strict' mode)
error intermittently when processing batch files using the StaxEventItemReader. It happens 40% of the time and when it does, the JVM has to be restarted before the reader can now read this file.
the step is configured as -
<step id="recordProcessingStep" parent="baseProcessingStep" next="stepFlowDecision">
<tasklet>
<chunk reader="staxEventItemReader" processor="requestItemProcessor" writer="chunkProvidingItemWriter"/>
</tasklet>
</step>
and the reader is configured as -
<bean id="staxEventItemReader" scope="step" class="org.springframework.batch.item.xml.StaxEven tItemReader">
<property name="fragmentRootElementName" value="#{jobParameters[fragmentRootElementName]}" />
<property name="resource" ref="inputResource" />
<property name="unmarshaller" ref="genericXmlMarshaller" />
</bean>
the input resource is configured as -
<bean id="inputResource" scope="step" class="org.springframework.core.io.FileSystemResou rce">
<constructor-arg value="#{jobParameters[inputFile]}" />
</bean>
the job is launched using WorkManager -
<bean id="jobLauncher" class="org.springframework.batch.core.launch.suppo rt.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
<property name="taskExecutor" ref="taskExecutor"/>
</bean>
<bean id="taskExecutor" class="org.springframework.scheduling.commonj.Work ManagerTaskExecutor">
<property name="workManagerName" value="${jndi.wm.name}" />
</bean>
This works without a problem 60% of the time. For the remaining 40%, the JVM has to be re-started before the StaxEventItemReader can read the file.
This seems like a threading (thread-safety) issue with the StaxEventItemReader or the reader does not always initialize properly with dynamic resources. Unfortunately, all our resources are dynamic.
Any advice please ?
Thanks!


Reply With Quote
