Announcement Announcement Module
Collapse
No announcement yet.
Partioned step fails when launched from EJB Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Partioned step fails when launched from EJB

    Hi,

    I have a batch job with following configuration.

    Code:
    <job id="createGroups" restartable="true">
    	<step id="createGroupData">
    		<tasklet ref="createGroupTaskManager" transaction-manager="transactionManager">
    		</tasklet>
    		<next on="COMPLETED" to="createGroupsStep" />
    	</step>
    	<step id="createGroupsStep">
    		<partition step="partitionedCreateGroups" partitioner="groupRecordPartitioner">
    			<handler grid-size="10" task-executor="simpleTaskExecutor" />
    		</partition>
    	</step>
    </job>
    
    <beans:bean id="simpleTaskExecutor" class="org.springframework.core.task.SimpleAsyncTaskExecutor">  
       	<beans:property name="concurrencyLimit" value="10"/>
    </beans:bean>
    When launched from JUnit the partitioned step works fine. But when launched from an EJB within Container (BMP), the step fails with below stacktrace.

    Code:
    	org.springframework.dao.EmptyResultDataAccessException: Incorrect result size: expected 1, actual 0
    	at org.springframework.dao.support.DataAccessUtils.requiredSingleResult(DataAccessUtils.java:71)
    	at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:729)
    	at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:744)
    	at org.springframework.jdbc.core.JdbcTemplate.queryForInt(JdbcTemplate.java:775)
    	at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForInt(SimpleJdbcTemplate.java:114)
    	at org.springframework.batch.core.repository.dao.JdbcStepExecutionDao.updateStepExecution(JdbcStepExecutionDao.java:183)
    	at org.springframework.batch.core.repository.support.SimpleJobRepository.update(SimpleJobRepository.java:171)
    	at sun.reflect.GeneratedMethodAccessor141.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    	at $Proxy121.update(Unknown Source)
    	at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:183)
    	at org.springframework.batch.core.partition.support.TaskExecutorPartitionHandler$1.call(TaskExecutorPartitionHandler.java:108)
    	at org.springframework.batch.core.partition.support.TaskExecutorPartitionHandler$1.call(TaskExecutorPartitionHandler.java:106)
    	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    	at org.springframework.core.task.SimpleAsyncTaskExecutor$ConcurrencyThrottlingRunnable.run(SimpleAsyncTaskExecutor.java:229)
    Can anyone help ? Thanks for the support.

  • #2
    Is the EJB wrapped in a transaction (container managed transactions)? If so, batch jobs should not be launched from within a transaction. It manages it's own transactions and there can be issues when executed that way.

    Comment

    Working...
    X