Announcement Announcement Module
Collapse
No announcement yet.
StaxEventItemReader bug - open() fails intermittently on resource Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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?

    Comment


    • #3
      StaxEventItemReader bug - open() fails intermittently on resource

      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 ?

      Comment

      Working...
      X