Announcement Announcement Module
No announcement yet.
Itemreader Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Itemreader

    i have this exception, can you help me :

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

    my dao classe where i use my itemreader

    public class FileADCDao extends JdbcDaoSupport implements IFileADCDao  {
    	private ItemReader itemReader;
    public BeanADC saveAdcFile() {
    		String ligne="";
    		BeanADC beanADC = new BeanADC();
    		try {
    			ligne =;
    			//ligne = "1010;5151;51515;5515";
    		} catch (Exception e) {
    		beanADC = repartir(ligne);

  • #2
    Some ItemReaders like the FlatFileItemReader must be opened before they can be accessed. This is typically handled in the Step where the ItemReader is used. Can you post your configuration and explain what you are trying to do in the Job?


    • #3
      That's a very odd setup for an ItemReader. It looks like you have a dao that is 'saving' something, by reading from a file?

      Thomas is correct in that you need to register the reader with the Step (the reference documentation covers how to do this in detail), but it still seems like a bit of an odd setup to me.


      • #4
        the role of the job is to take each line of a file to execute a query, therefore, whenever I have to take the line that serves as a parameter for the motion and finally take the result of this request to insert it into another table

        tank you for your help


        • #5
          Shouldn't the line in the file then be the 'item' that the ItemWriter is 'writing' then?


          • #6
            Sounds to me that you want to provide some item transformation as part of either the reader or writer. Look at 3.10. Item Transforming for more on how to implement this.


            • #7
              Originally posted by lucasward View Post
              Shouldn't the line in the file then be the 'item' that the ItemWriter is 'writing' then?

              the lines are used just as parameters of requetes