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

  • AlreadyCompleteException

    Hello,

    I am facing a problem using spring batch and quartz,

    the job is excuted the first time whitout any problem, but after i have the exception below :

    org.springframework.batch.core.repository.JobInsta nceAlreadyCompleteException: A job instance already exists and is complete for parameters={}. If you want to run this job again, change the parameters.


    my batch config :

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:batch="http://www.springframework.org/schema/batch"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-3.0.xsd
    http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd">
    <bean
    class="org.springframework.batch.core.configuratio n.support.JobRegistryBeanPostProcessor">
    <property name="jobRegistry" ref="jobRegistry" />
    </bean>
    <bean id="jobRegistry"
    class="org.springframework.batch.core.configuratio n.support.MapJobRegistry" />

    <bean name="dynamicJobIncrementer"
    class="org.springframework.batch.core.launch.suppo rt.RunIdIncrementer" />


    <bean id="jobLauncher"
    class="org.springframework.batch.core.launch.suppo rt.SimpleJobLauncher">
    <property name="jobRepository" ref="jobRepository" />
    <property name="taskExecutor">
    <bean class="org.springframework.core.task.SimpleAsyncTa skExecutor" />
    </property>
    </bean>

    <bean id="jobDetail" class="org.springframework.scheduling.quartz.JobDe tailBean">
    <property name="jobClass"
    value="org.springframework.batch.sample.quartz.Job LauncherDetails" />
    <property name="group" value="quartz-batch" />
    <property name="jobDataAsMap">
    <map>
    <entry key="jobName" value="testJob" />
    <entry key="jobLocator" value-ref="jobRegistry" />
    <entry key="jobLauncher" value-ref="jobLauncher" />
    </map>
    </property>
    </bean>

    <bean class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
    <property name="triggers">
    <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronT riggerBean">
    <property name="jobDetail" ref="jobDetail" />
    <property name="cronExpression" value="0/30 * * * * ?" />
    </bean>
    </property>
    </bean>


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



    <bean id="pum"
    class="org.springframework.orm.jpa.persistenceunit .DefaultPersistenceUnitManager">
    <property name="persistenceXmlLocations">
    <list>
    <value>classpath*:META-INF/persistence.xml</value>
    </list>
    </property>
    </bean>
    <bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean">

    <property name="persistenceUnitManager" ref="pum" />
    <property name="persistenceUnitName" value="referentielMetier" />
    <property name="jpaVendorAdapter">
    <bean class="org.springframework.orm.jpa.vendor.Hibernat eJpaVendorAdapter">
    <property name="showSql" value="true" />
    </bean>
    </property>
    <property name="jpaDialect">
    <bean class="org.springframework.orm.jpa.vendor.Hibernat eJpaDialect" />
    </property>
    </bean>

    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionM anager">
    <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>

    <bean id="defaultBatch" class="ma.iba.tools.batch.DefaultBatch">
    <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>

    <bean id="UC_BATCH_083" class="ma.iba.gestionCommerciale.stock.UC_BATCH_08 3">
    <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>


    <batch:job id="testJob" job-repository="jobRepository"
    incrementer="dynamicJobIncrementer">
    <batch:step id="Step">
    <batch:tasklet>
    <batch:chunk reader="UC_BATCH_083" writer="UC_BATCH_083"
    processor="UC_BATCH_083" commit-interval="10">
    </batch:chunk>
    </batch:tasklet>
    </batch:step>
    </batch:job>
    </beans>

    is there any extra to add ?

    Thanks in advance.
Working...
X