• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Spring Batch Job seems to be starting one step before last one finishes?

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am new to Spring Batch and hope someone can help me.

I have a simple job with three steps. The first steps does something with a file using a tasklet and then writes it back with a different name/extenstion. Step 2 is a chunk related reader/writer step that picks up this file, reads it with a multiresourceitemreader (so that I could use wildcards) and writes it to a database. Step 3 renames this file.

At first my job was implemented with step 2 only - works great. I then added the rename step - works fine. Then lastly I added step one...this is where the trouble starts. Step 1 on its own works...I can see the file being written back with the different extention. But step 2 now gives me a warning that there is no resources to be read. If then I comment out my tasklet code for step 1 (so the changed filename is still in the folder) and run the job again...then it does pick it up. So it almost seems as if Step 2 tries to find the file before it is written? Is this possible? Am I understanding batch correctly that one step has to complete before the next one start (in the way I wired it up?) Any ideas of what I can try to solve this?

Some code samples below.


Ranch Hand
Posts: 607
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't step three actually rename the file to *_TEST.txt. So why do you expect step "2" to find such files?
Spring should execute the steps in order of the "next" specified on the step ...

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!