Results 1 to 3 of 3

Thread: StaxEventItemReader bug - open() fails intermittently on resource

  1. #1
    Join Date
    Aug 2010
    Posts
    23

    Exclamation StaxEventItemReader bug - open() fails intermittently on resource

    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!

  2. #2
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    Very strange, and it all works for me. Is this a platform-dependent problem (does it do away if you switch to/from Windows)? Can you create a test case that demonstrates the issue?

  3. #3
    Join Date
    May 2012
    Posts
    1

    Default StaxEventItemReader bug - open() fails intermittently on resource

    Quote Originally Posted by Dave Syer View Post
    Very strange, and it all works for me. Is this a platform-dependent problem (does it do away if you switch to/from Windows)? Can you create a test case that demonstrates the issue?
    Hi,

    Unfortunately, I get the same error on my Windows XP workstation.
    I am using Spring MVC to trigger Spring Batch on the availability of an XML File.
    Castor 1.3.1 is used for XML to POJO conversion.

    The exact scenario is when there are more than 1 file available in the input folder. My application will eventually run on a Windows Server.

    Any thoughts as to the source of the problem ?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •