Announcement Announcement Module
No announcement yet.
Configuration of a job repository bean fails in combination with BATCH-1668 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configuration of a job repository bean fails in combination with BATCH-1668

    After replacing the references from 2.1.5 to 2.1.6, without any other changes, an internal test failed. It seems that changes for BATCH-1668 are responsible for this.
    Section "4.2.1. Transaction Configuration for the JobRepository" still defines the same transaction advices as for the 2.1.5 release. Removing this advice will fix the thrown exception:
    Caused by: java.lang.IllegalStateException: Existing transaction detected in JobRepository. Please fix this and try again (e.g. remove @Transactional annotations from client).
    Is the advice still a requirement, if the job repository is not defined via the Spring Batch namespace (we used the depends-on-attribute in the test case)?

  • #2
    The advice should be created for you if you use the JobRepositoryFactoryBean. If you need to customize the creation of the repository, look at the implementation of the factory bean to see how to do it manually.


    • #3
      Hi Dave,

      thanks for your fast reply, but we neither use the Factory nor the Spring Batch Namespace. We defined the repository as following:
      <bean id="jobRepository" class=""
         <property name="transactionManager" ref="transactionManager" />
         <property name="dataSource" ref="dataSource" />
         <property name="isolationLevelForCreate" value="ISOLATION_READ_COMMITTED" />
      So according to the documentation:
      If the namespace or factory beans aren't used then it is also essential to configure the transactional behavior of the repository using AOP:
      we have to use the advice. The usage of the advice results in the above-mentioned exception.

      Kind regards


      • #4
        I think you misread your own configuration - you are using the JobRepositoryFactoryBean. It does creates the AOP advice for you. You probably wrapped it twice?
        Last edited by Dave Syer; Feb 9th, 2011, 12:05 PM. Reason: spelling


        • #5
          Damn! I double checked our configuration with a second developer and both does not realize the bean name error. Thanks a lot!

          Kind regards