Announcement Announcement Module
Collapse
No announcement yet.
BATCH_JOB_EXECUTION status stuck in STARTING Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • BATCH_JOB_EXECUTION status stuck in STARTING

    Hi have have a job configured to persist the job repository to a db (oracle)

    The unit test runs ok, but it will only run once then i get an exception

    org.springframework.batch.core.repository.JobExecu tionAlreadyRunningException: A job execution for this job is already running: JobInstance:

    If I look in the BATCH_JOB_EXECUTION the status set to STARTING.

    here is my config


    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:jee="http://www.springframework.org/schema/jee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd">
    
    	<bean id="hello"
    		class="player.profile.ProfileOutput">
    		<property name="message" value="my" />
    	</bean>
    
    	<bean id="apa"
    		class="com.bossmedia.gem.components.player.profile.ProfileOutput">
    		<property name="message" value="test" />
    	</bean>
    
    	<bean id="taskletStep" abstract="true"
    		class="org.springframework.batch.core.step.tasklet.TaskletStep">
    		<property name="jobRepository" ref="jobRepository" />
    		<property name="transactionManager" ref="transactionManager" />
    	</bean>
    
    	<bean id="simpleJob" class="org.springframework.batch.core.job.SimpleJob">
    		<property name="name" value="simpleJob" />
    		<property name="steps">
    			<list>
    				<bean parent="taskletStep">
    					<property name="tasklet" ref="hello" />
    				</bean>
    				<bean parent="taskletStep">
    					<property name="tasklet" ref="apa" />
    				</bean>
    			</list>
    		</property>
    		<property name="jobRepository" ref="jobRepository" />
    	</bean>
    
    
    	<bean id="jobLauncher"
    		class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
    		<property name="jobRepository" ref="jobRepository" />
    	</bean>
    
    	<!-- change to map here for in-memory -->
    	<bean id="jobRepository"
    		class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
    		<property name="transactionManager" ref="transactionManager" />
    		<property name="dataSource" ref="dataSource"/>
    		<property name="databaseType" value="oracle" />
      		<property name="tablePrefix" value="batch_"/>
    
    	</bean>
    
    
    	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
    		<property name="url" value="jdbc:oracle:thin:@localhost:1521:XE" />
    		<property name="username" value="user" />
    		<property name="password" value="psw" />
    	</bean>
    
    
    	<bean id="transactionManager"
    		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    		<property name="dataSource" ref="dataSource" />
    	</bean>
    
    </beans>

  • #2
    If you get a JobExecutionAlreadyRunningException and you don't think it's true, then maybe you killed the process that execution was running in? You need to upgrade it to FAILED or ABORTED manually, or using a JobRepository, before you can restart it.

    You can always start a new instance (new jobParameters) as well.
    Last edited by Dave Syer; Aug 15th, 2010, 03:19 AM. Reason: word order

    Comment


    • #3
      FYI

      It is always better to have unique set of JobParameters for every Job instance.

      Comment

      Working...
      X