Announcement Announcement Module
Collapse
No announcement yet.
Using JtaTransactionManager in Batch!! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using JtaTransactionManager in Batch!!

    Hi,
    We separated the batch schema from the business schema and trying to use JtaTransactionManager. I am getting the following exception when the batch is getting deployed in the Jboss Server. This exception occurs only when i try to use JtaTransactionManager.

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'quartzEnhancedSchedulerFactory' defined in class path resource [quartz-scheduler.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'balanceReconciliationJob' defined in file [D:\Tools\jboss-4.0.5.GA\server\default\.\tmp\deploy\tmp2977DarkHo rse-Batch-exp.war\WEB-INF\classes\jobs\balanceReconciliation.xml]: Cannot create inner bean 'EX027FileLoaderStep' of type [com.om.dh.batch.core.FileLoaderStepFactoryBean] while setting bean property 'steps' with key [1]; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'EX027FileLoaderStep': FactoryBean threw exception on object creation; nested exception is org.springframework.transaction.UnexpectedRollback Exception: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException: Already marked for rollback TransactionImpl:XidImpl[FormatId=257, GlobalId=Ramkumar-TI6964/14, BranchQual=, localId=14]
    It fails in the following step. This step reads the file and dumps into a table found in business schema.
    <bean id="EX027FileLoaderStep" parent="fileLoaderStep" scope="prototype">
    <property name="filePath"
    value="${batch.reconciliation.balance.EX027filepat h}" />
    <property name="lineTokenizer" ref="EXT027delimitedFileTokenizer" />
    <property name="tableName" value="bm_clearing_firm_balance" />
    <property name="truncateTable" value="true" />
    <property name="fileTransferObject" ref="balanceFileObject" />
    </bean>
    <bean id="fileLoaderStep" class="com.om.dh.batch.core.FileLoaderStepFactoryB ean"
    abstract="true" >
    <property name="skipLimit" value="1000"/>
    <property name="allowStartIfComplete" value="true" />
    <property name="transactionManager" ref="txMgr" />
    <property name="jobRepository" ref="simpleJobRepository" />
    <property name="jdbcTemplate" ref="jdbcTemplate"/>
    <property name="commitInterval" value="1000" />

    </bean>
    ...
    <bean id="txMgr" class="org.springframework.transaction.jta.JtaTran sactionManager">
    <property name="userTransactionName">
    <value>java:comp/UserTransaction</value>
    </property>
    <property name="transactionManagerName">
    <value>java:/TransactionManager</value>
    </property>
    </bean>
    Is anyone faced similar issues while using JtaTransactionManager with Batch?

    regards,
    Ramkris

  • #2
    I wonder if it's a timeout issue? Your commit interval is fairly high, so it could take awhile between commits.

    Comment


    • #3
      Originally posted by lucasward View Post
      I wonder if it's a timeout issue? Your commit interval is fairly high, so it could take awhile between commits.
      I am not sure why it happens when the application is getting deployed. Job is not even getting executed that time. I am able to fix the issue by adding the below line in my mysql-ds.xml.
      <track-connection-by-tx>true</track-connection-by-tx>
      Anyone knows what this does?

      Comment

      Working...
      X