Results 1 to 2 of 2

Thread: Table 'batch_job_instance' already exists error when trying to execute Spring Batch

  1. #1
    Join Date
    Oct 2012
    Posts
    8

    Red face Table 'batch_job_instance' already exists error when trying to execute Spring Batch

    Hello everyone,
    I created a new Spring batch job using database functionality using MySql and it works fine the very first time it runs. I see that Spring batch creates the metadata tables and is able to pull data from my product table for use with the batch process. If I run the batch job again, I am getting an error that Table 'batch_job_instance' already exists. So Batch is trying to recreate the metadata tables, even though they have already been created by the previous job. I've been looking around, and I haven't figured out how to tell Spring Batch that the metadata tables have already been created.

    Any help would be greatly appreciated...thanks!

  2. #2
    Join Date
    Sep 2008
    Location
    Chicagoland, IL
    Posts
    338

    Default

    You probably have the DataSourceInitializer still configured in your launch-context.xml. This will attempt to execute the provided script ever time it's bootstrapped. Remove it and you should be fine.
    Michael Minella
    Spring Batch Lead
    Author - Pro Spring Batch
    http://www.michaelminella.com
    Twitter: @MichaelMinella

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •