org.springframework.batch.item.ReaderNotOpenException: Reader must be open before it can be read.

Spring JIRA | Roman Urosov | 8 years ago
  1. 0

    configuration: <job id="myjob"> <step id="importFile" next="createWorkDrivers"> <tasklet> <chunk reader="fileReader" writer="hibernateWriter" task-executor="taskExecutor" commit-interval="10"> <streams> <stream ref="fileReader" /> </streams> </chunk> </tasklet> </step> </job> <beans:bean id="fileReader" scope="step" class="org.springframework.batch.item.file.FlatFileItemReader"> <beans:property name="resource" value="#{jobParameters[file]}" /> <beans:property name="lineMapper"> <beans:bean class="my.super.Mapper" /> </beans:property> </beans:bean> exception: org.springframework.batch.item.ReaderNotOpenException: Reader must be open before it can be read. at org.springframework.batch.item.file.FlatFileItemReader.readLine(FlatFileItemReader.java:195) at org.springframework.batch.item.file.FlatFileItemReader.doRead(FlatFileItemReader.java:166) at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:84) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy1.read(Unknown Source) at org.springframework.batch.core.step.item.SimpleChunkProvider.doRead(SimpleChunkProvider.java:90) at org.springframework.batch.core.step.item.SimpleChunkProvider.read(SimpleChunkProvider.java:127) at org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration(SimpleChunkProvider.java:106) at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:352) at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:212) at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143) at org.springframework.batch.core.step.item.SimpleChunkProvider.provide(SimpleChunkProvider.java:103) at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:64) at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:264) at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:67) at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:230) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

    Spring JIRA | 8 years ago | Roman Urosov
    org.springframework.batch.item.ReaderNotOpenException: Reader must be open before it can be read.
  2. 0

    configuration: <job id="myjob"> <step id="importFile" next="createWorkDrivers"> <tasklet> <chunk reader="fileReader" writer="hibernateWriter" task-executor="taskExecutor" commit-interval="10"> <streams> <stream ref="fileReader" /> </streams> </chunk> </tasklet> </step> </job> <beans:bean id="fileReader" scope="step" class="org.springframework.batch.item.file.FlatFileItemReader"> <beans:property name="resource" value="#{jobParameters[file]}" /> <beans:property name="lineMapper"> <beans:bean class="my.super.Mapper" /> </beans:property> </beans:bean> exception: org.springframework.batch.item.ReaderNotOpenException: Reader must be open before it can be read. at org.springframework.batch.item.file.FlatFileItemReader.readLine(FlatFileItemReader.java:195) at org.springframework.batch.item.file.FlatFileItemReader.doRead(FlatFileItemReader.java:166) at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:84) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy1.read(Unknown Source) at org.springframework.batch.core.step.item.SimpleChunkProvider.doRead(SimpleChunkProvider.java:90) at org.springframework.batch.core.step.item.SimpleChunkProvider.read(SimpleChunkProvider.java:127) at org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration(SimpleChunkProvider.java:106) at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:352) at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:212) at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143) at org.springframework.batch.core.step.item.SimpleChunkProvider.provide(SimpleChunkProvider.java:103) at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:64) at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:264) at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:67) at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:230) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

    Spring JIRA | 8 years ago | Roman Urosov
    org.springframework.batch.item.ReaderNotOpenException: Reader must be open before it can be read.
  3. 0

    Partitioner for JdbcCursorItemReader - Reader must be open before it can be read

    Stack Overflow | 4 months ago | Richie
    org.springframework.batch.item.ReaderNotOpenException: Reader must be open before it can be read.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    org.springframework.batch.item.ReaderNotOpenException: Reader must be open before it can be read

    Stack Overflow | 3 years ago | Joshua
    org.springframework.batch.item.ReaderNotOpenException: Reader must be open before it can be read.
  6. 0

    How does one open a Reader when implementing ItemReader in a Spring Batch project?

    Stack Overflow | 3 years ago | yamori
    org.springframework.batch.item.ReaderNotOpenException: Reader must be open before it can be read.

    2 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.batch.item.ReaderNotOpenException

      Reader must be open before it can be read.

      at org.springframework.batch.item.file.FlatFileItemReader.readLine()
    2. Spring Batch Infrastructure
      AbstractItemCountingItemStreamItemReader.read
      1. org.springframework.batch.item.file.FlatFileItemReader.readLine(FlatFileItemReader.java:195)
      2. org.springframework.batch.item.file.FlatFileItemReader.doRead(FlatFileItemReader.java:166)
      3. org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:84)
      3 frames
    3. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      4. java.lang.reflect.Method.invoke(Unknown Source)
      4 frames
    4. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      4. org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
      5. org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
      6. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      7. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      7 frames
    5. Unknown
      $Proxy1.read
      1. $Proxy1.read(Unknown Source)
      1 frame
    6. Spring Batch Core
      SimpleChunkProvider$1.doInIteration
      1. org.springframework.batch.core.step.item.SimpleChunkProvider.doRead(SimpleChunkProvider.java:90)
      2. org.springframework.batch.core.step.item.SimpleChunkProvider.read(SimpleChunkProvider.java:127)
      3. org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration(SimpleChunkProvider.java:106)
      3 frames
    7. Spring Batch Infrastructure
      RepeatTemplate.iterate
      1. org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:352)
      2. org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:212)
      3. org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)
      3 frames
    8. Spring Batch Core
      StepContextRepeatCallback.doInIteration
      1. org.springframework.batch.core.step.item.SimpleChunkProvider.provide(SimpleChunkProvider.java:103)
      2. org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:64)
      3. org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:264)
      4. org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:67)
      4 frames
    9. Spring Batch Infrastructure
      TaskExecutorRepeatTemplate$ExecutingRunnable.run
      1. org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:230)
      1 frame
    10. Java RT
      ThreadPoolExecutor$Worker.run
      1. java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      2 frames