Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 28

Thread: Stoping -Spring batch Job

  1. #11
    Join Date
    Dec 2010
    Posts
    20

    Default

    yes , It is using the same repository .

  2. #12
    Join Date
    Dec 2010
    Posts
    20

    Default

    I am using my own transaction manger , does it have any role in not stoping the Job .

    Transaction manger doesn't check any thing specific .

    Below is the config for that
    <bean id="transactionManager" class="com.real.ramses.ingestor.transformer.Ingest orTransactionManager" />

    <bean id="jobRepository" class="org.springframework.batch.core.repository.s upport.MapJobRepositoryFactoryBean">
    <property name="transactionManager" ref="transactionManager"/>
    </bean>

  3. #13
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    Ah. Well it's not the transaction manager as such, but the repository is a problem. If you use a Map JobRepository, how do you expect it to be shared between the two processes (the one that launches it and the one that stops it)? You can still call JobExecution.stop() on the original running instance if you keep a reference to it, but using CommandLineJobRunner you will always be in a new process, so there is no way to exchange data without an external JobRepository.

  4. #14
    Join Date
    Dec 2010
    Posts
    20

    Default

    thanks , I was trying to find the example which has used external repository , I Haven't found any , All of the examples use either MapRepository or simpleJob Repository .

    If you can point me to any of the examples which uses external Repository , That will help me a lot .

    thanks

  5. #15
    Join Date
    Dec 2010
    Posts
    20

    Default

    I am trying External repo as DERBY Db ,
    I have created tables and the tables required for sequece in derby .

    But getting below error once i start a job , Is their any particular steps i need to follow ?


    [mmandLineJobRunner.main()] ERROR CommandLineJobRunner - Job Terminated in error: Could not obtain IDENTITY value; nested exception is java.sql.SQLSyntaxErrorException: 'DUMMY' is not a column in table or VTI 'APP.BATCH_JOB_SEQ'.

  6. #16
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    You need to set up the database with the correct tables. There are scripts in the core jar file.

    I wouldn't recommend Derby for production use, and you may see strange behaviour with pagination.

  7. #17
    Join Date
    Dec 2010
    Posts
    20

    Default

    Dave ,

    I Started using Mysql as my DB , Created all the tables required started job using the below command .

    mvn exec:java -Dexec.mainClass=org.springframework.batch.core.lau nch.support.CommandLineJobRunner -Dexec.args="ingestor-config.xml job run.id=11"

    After some time i wanted to stop my job , I used below command to stop


    mvn exec:java -Dexec.mainClass=org.springframework.batch.core.lau nch.support.CommandLineJobRunner -stop -Dexec.args="ingestor-config.xml job run.id=11"

    JOb didn't stop it was still running , is it not possible to stop a job using this command ?\

    Exact Error :

    2011-02-21 15:16:02,454 [mmandLineJobRunner.main()] ERROR CommandLineJobRunner - Job Terminated in error: A job execution for this job is already running: JobInstance: id=10, JobParameters=[{run.id=11}], Job=[job]
    org.springframework.batch.core.repository.JobExecu tionAlreadyRunningException: A job execution for this job is already running: JobInstance: id=10, JobParameters=[{run.id=11}], Job=[job]
    Last edited by didilip; Feb 21st, 2011 at 03:47 AM.

  8. #18
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    I think there's a typo in your command line (-stop should be in the arguments to the main method). Does that fix it?

  9. #19
    Join Date
    Dec 2010
    Posts
    20

    Default

    did you mean like

    mvn exec:java -Dexec.mainClass=org.springframework.batch.core.lau nch.support.CommandLineJobRunner -stop -Dexec.args="ingestor-config.xml job run.id=11 -stop"

    or

    vn exec:java -Dexec.mainClass=org.springframework.batch.core.lau nch.support.CommandLineJobRunner -Dexec.args="ingestor-config.xml job -stop run.id=11"

    if yes , These commads are n ot stoping the job , instead throwing the same error as shown above .

    thanks

  10. #20
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    That's what I meant (either should work). What version of Spring Batch are you using?

Posting Permissions

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