Announcement Announcement Module
No announcement yet.
problems configuring transaction manager for taskletStep Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • problems configuring transaction manager for taskletStep

    Hello, essentially I'm trying to run an example from which is a little dated and was probably written for an older version of spring but I believe it should still be valid. I have a tasklet definition:

    <bean id="taskletStep" abstract="true"
    class="org.springframework.batch.core.step.tasklet .TaskletStep">
    <property name="jobRepository" ref="jobRepository"/>

    When I run the program I get an error:
    Error creating bean with name 'taskletStep$child#1bfa3d3' defined in class path resource [simpleJob.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: TransactionManager is mandatory.

    The problem is that I don't have any valid transaction manager bean (i.e. implementing the org.springframework.transaction.PlatformTransactio nManager interface) defined anywhere because this simple test program that does not perform any database access. How do I resolve this? Is there an "empty" or "default" or "dummy" transaction manager implementation I could use?

  • #2
    you could go with the (ResourcelessTransactionManager is mentioned there too)

    or you could configure a in-memory database with e.g. HSQLDB

        <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
            <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
            <property name="url" value="jdbc:hsqldb:mem:testdb" />
            <property name="username" value="sa" />
            <property name="password" value="" />
        <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <property name="dataSource" ref="dataSource" />
        <jdbc:initialize-database data-source="dataSource">
            <jdbc:script location="org/springframework/batch/core/schema-hsqldb.sql"/>
    needed dependencies

                <version>${2.5.6.RELEASE or 3.0.5.RELEASE}</version>


    • #3
      Thanks. Actually I ended up writing my own transaction manager stub which turned out easier than I thought. Seems to be working...

      public class StubTransactionManager implements PlatformTransactionManager {

      public void commit(TransactionStatus arg0) throws TransactionException {

      public TransactionStatus getTransaction(TransactionDefinition arg0)
      throws TransactionException {
      return new SimpleTransactionStatus();

      public void rollback(TransactionStatus arg0) throws TransactionException {