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

Stack Overflow | Richie | 7 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

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

    Stack Overflow | 7 months ago | Richie
    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

    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.
  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.database.AbstractCursorItemReader.doRead()
    2. Spring Batch Infrastructure
      AbstractItemCountingItemStreamItemReader.read
      1. org.springframework.batch.item.database.AbstractCursorItemReader.doRead(AbstractCursorItemReader.java:443)[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      2. org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:88)[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      2 frames
    3. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0_101]
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[na:1.8.0_101]
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.8.0_101]
      4. java.lang.reflect.Method.invoke(Method.java:498)[na:1.8.0_101]
      4 frames
    4. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)[spring-aop-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)[spring-aop-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)[spring-aop-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      4. org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)[spring-aop-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      5. org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)[spring-aop-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      6. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      7. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)[spring-aop-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      7 frames
    5. com.sun.proxy
      $Proxy58.read
      1. com.sun.proxy.$Proxy58.read(Unknown Source)[na:na]
      1 frame
    6. Spring Batch Core
      SimpleChunkProvider$1.doInIteration
      1. org.springframework.batch.core.step.item.SimpleChunkProvider.doRead(SimpleChunkProvider.java:91)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      2. org.springframework.batch.core.step.item.SimpleChunkProvider.read(SimpleChunkProvider.java:157)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      3. org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration(SimpleChunkProvider.java:116)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      3 frames
    7. Spring Batch Infrastructure
      RepeatTemplate.iterate
      1. org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:374)[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      2. org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      3. org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      3 frames
    8. Spring Batch Core
      TaskletStep$ChunkTransactionCallback.doInTransaction
      1. org.springframework.batch.core.step.item.SimpleChunkProvider.provide(SimpleChunkProvider.java:110)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      2. org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:69)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      3. org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      4. org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      4 frames
    9. Spring Tx
      TransactionTemplate.execute
      1. org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)[spring-tx-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      1 frame
    10. Spring Batch Core
      StepContextRepeatCallback.doInIteration
      1. org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      2. org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      2 frames
    11. Spring Batch Infrastructure
      RepeatTemplate.iterate
      1. org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:374)[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      2. org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      3. org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      3 frames
    12. Spring Batch Core
      TaskExecutorPartitionHandler$1.call
      1. org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:257)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      2. org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:200)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      3. org.springframework.batch.core.partition.support.TaskExecutorPartitionHandler$1.call(TaskExecutorPartitionHandler.java:139)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      4. org.springframework.batch.core.partition.support.TaskExecutorPartitionHandler$1.call(TaskExecutorPartitionHandler.java:136)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      4 frames
    13. Java RT
      Thread.run
      1. java.util.concurrent.FutureTask.run(FutureTask.java:266)[na:1.8.0_101]
      2. java.lang.Thread.run(Thread.java:745)[na:1.8.0_101]
      2 frames