org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is bitronix.tm.internal.BitronixRollbackException: RuntimeException thrown during beforeCompletion cycle caused transaction rollback There's some of the configuration I'm using (please see github for all of it) @Bean public JPAConfig jpaConfig() throws Exception { Properties p = new Properties(); p.setProperty("hibernate.dialect", HSQLDialect.class.getName()); p.setProperty("hibernate.hbm2ddl.auto", "create-drop"); p.setProperty("hibernate.showsql", "true"); return new JPAConfig(p, datasource(), true, "com.kloudtek.ktspring"); } public DataSource datasource() throws Exception { PoolingDataSource dataSource = new PoolingDataSource(); dataSource.setClassName("bitronix.tm.resource.jdbc.lrc.LrcXADataSource"); dataSource.setUniqueName("hsqldb"); dataSource.setMaxPoolSize(5); dataSource.setAllowLocalTransactions(true); dataSource.getDriverProperties().setProperty("driverClassName", "org.hsqldb.jdbcDriver"); dataSource.getDriverProperties().setProperty("url", "jdbc:hsqldb:mem:test?hsqldb.applog=3"); dataSource.getDriverProperties().setProperty("user", "sa"); dataSource.getDriverProperties().setProperty("password", "theSaPassword"); try (Connection connection = dataSource.getConnection()) { try (Statement st = connection.createStatement()) { st.execute("SET DATABASE EVENT LOG SQL LEVEL 3"); } } return dataSource; } @Bean public JPAParams jpaParams() { Properties p = new Properties(); p.setProperty("hibernate.current_session_context_class", "jta"); p.setProperty("hibernate.transaction.jta.platform", BitronixJtaPlatform.class.getName()); p.setProperty("hibernate.connection.autocommit", "false"); return new JPAParams(p); } @Bean(destroyMethod = "shutdown") public BitronixTransactionManager bitronixTransactionManager() { return TransactionManagerServices.getTransactionManager(); } @Bean public PlatformTransactionManager transactionManager() { return new JtaTransactionManager(bitronixTransactionManager(), bitronixTransactionManager()); } @Bean public LocalContainerEntityManagerFactoryBean entityManager() { LocalContainerEntityManagerFactoryBean entityManager = new LocalContainerEntityManagerFactoryBean(); if (config.isJtaDatasource()) { entityManager.setJtaDataSource(config.getDataSource()); } else { entityManager.setDataSource(config.getDataSource()); } Properties p = new Properties(); p.putAll(config.getJpaProperties()); if (jpaParamsList != null) { for (JPAParams jpaParams : jpaParamsList) { p.putAll(jpaParams.getProperties()); } } entityManager.setJpaProperties(p); entityManager.setPackagesToScan(config.getPackageToScan()); entityManager.setPersistenceProvider(new HibernatePersistenceProvider()); return entityManager; } After a lot of debugging, it looks like the entitymanager is being closed by spring. This seems to happen because EntityManagerHolder gets registered with the transaction synchronization, but I would have though this should only happen in the case of a JPA transaction but NOT when JTA is used ........... going to continue investigating at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:347)

  1. 0

    Spring + hibernate JPA + JTA (Atomikos / Bitronix) failing

    Stack Overflow | 3 months ago | Yannick Menager
    org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is bitronix.tm.internal.BitronixRollbackException: RuntimeException thrown during beforeCompletion cycle caused transaction rollback There's some of the configuration I'm using (please see github for all of it) @Bean public JPAConfig jpaConfig() throws Exception { Properties p = new Properties(); p.setProperty("hibernate.dialect", HSQLDialect.class.getName()); p.setProperty("hibernate.hbm2ddl.auto", "create-drop"); p.setProperty("hibernate.showsql", "true"); return new JPAConfig(p, datasource(), true, "com.kloudtek.ktspring"); } public DataSource datasource() throws Exception { PoolingDataSource dataSource = new PoolingDataSource(); dataSource.setClassName("bitronix.tm.resource.jdbc.lrc.LrcXADataSource"); dataSource.setUniqueName("hsqldb"); dataSource.setMaxPoolSize(5); dataSource.setAllowLocalTransactions(true); dataSource.getDriverProperties().setProperty("driverClassName", "org.hsqldb.jdbcDriver"); dataSource.getDriverProperties().setProperty("url", "jdbc:hsqldb:mem:test?hsqldb.applog=3"); dataSource.getDriverProperties().setProperty("user", "sa"); dataSource.getDriverProperties().setProperty("password", "theSaPassword"); try (Connection connection = dataSource.getConnection()) { try (Statement st = connection.createStatement()) { st.execute("SET DATABASE EVENT LOG SQL LEVEL 3"); } } return dataSource; } @Bean public JPAParams jpaParams() { Properties p = new Properties(); p.setProperty("hibernate.current_session_context_class", "jta"); p.setProperty("hibernate.transaction.jta.platform", BitronixJtaPlatform.class.getName()); p.setProperty("hibernate.connection.autocommit", "false"); return new JPAParams(p); } @Bean(destroyMethod = "shutdown") public BitronixTransactionManager bitronixTransactionManager() { return TransactionManagerServices.getTransactionManager(); } @Bean public PlatformTransactionManager transactionManager() { return new JtaTransactionManager(bitronixTransactionManager(), bitronixTransactionManager()); } @Bean public LocalContainerEntityManagerFactoryBean entityManager() { LocalContainerEntityManagerFactoryBean entityManager = new LocalContainerEntityManagerFactoryBean(); if (config.isJtaDatasource()) { entityManager.setJtaDataSource(config.getDataSource()); } else { entityManager.setDataSource(config.getDataSource()); } Properties p = new Properties(); p.putAll(config.getJpaProperties()); if (jpaParamsList != null) { for (JPAParams jpaParams : jpaParamsList) { p.putAll(jpaParams.getProperties()); } } entityManager.setJpaProperties(p); entityManager.setPackagesToScan(config.getPackageToScan()); entityManager.setPersistenceProvider(new HibernatePersistenceProvider()); return entityManager; } After a lot of debugging, it looks like the entitymanager is being closed by spring. This seems to happen because EntityManagerHolder gets registered with the transaction synchronization, but I would have though this should only happen in the case of a JPA transaction but NOT when JTA is used ........... going to continue investigating at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:347)
  2. 0

    Atomikos with MySQL JTA not working properly

    Stack Overflow | 2 years ago | KobiM
    org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException: The transaction was set to rollback only
  3. 0

    [jboss-Usuario] [jBPM] - Concurrency problema cuándo completando dos ta

    listoso.com | 1 year ago
    org.jboss.resteasy.spi.UnhandledException: org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    UnexpectedRollbackException - JTA transaction unexpectedly rolled back

    Stack Overflow | 1 year ago | Raghu ram
    org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is weblogic.transaction.RollbackException: setRollbackOnly called on transaction
  6. 0

    debugging | Our Craft

    wordpress.com | 1 year ago
    org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is bitronix.tm.internal.BitronixRollbackException: transaction was marked as rollback only and has been rolled back

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.transaction.UnexpectedRollbackException

      JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is bitronix.tm.internal.BitronixRollbackException: RuntimeException thrown during beforeCompletion cycle caused transaction rollback There's some of the configuration I'm using (please see github for all of it) @Bean public JPAConfig jpaConfig() throws Exception { Properties p = new Properties(); p.setProperty("hibernate.dialect", HSQLDialect.class.getName()); p.setProperty("hibernate.hbm2ddl.auto", "create-drop"); p.setProperty("hibernate.showsql", "true"); return new JPAConfig(p, datasource(), true, "com.kloudtek.ktspring"); } public DataSource datasource() throws Exception { PoolingDataSource dataSource = new PoolingDataSource(); dataSource.setClassName("bitronix.tm.resource.jdbc.lrc.LrcXADataSource"); dataSource.setUniqueName("hsqldb"); dataSource.setMaxPoolSize(5); dataSource.setAllowLocalTransactions(true); dataSource.getDriverProperties().setProperty("driverClassName", "org.hsqldb.jdbcDriver"); dataSource.getDriverProperties().setProperty("url", "jdbc:hsqldb:mem:test?hsqldb.applog=3"); dataSource.getDriverProperties().setProperty("user", "sa"); dataSource.getDriverProperties().setProperty("password", "theSaPassword"); try (Connection connection = dataSource.getConnection()) { try (Statement st = connection.createStatement()) { st.execute("SET DATABASE EVENT LOG SQL LEVEL 3"); } } return dataSource; } @Bean public JPAParams jpaParams() { Properties p = new Properties(); p.setProperty("hibernate.current_session_context_class", "jta"); p.setProperty("hibernate.transaction.jta.platform", BitronixJtaPlatform.class.getName()); p.setProperty("hibernate.connection.autocommit", "false"); return new JPAParams(p); } @Bean(destroyMethod = "shutdown") public BitronixTransactionManager bitronixTransactionManager() { return TransactionManagerServices.getTransactionManager(); } @Bean public PlatformTransactionManager transactionManager() { return new JtaTransactionManager(bitronixTransactionManager(), bitronixTransactionManager()); } @Bean public LocalContainerEntityManagerFactoryBean entityManager() { LocalContainerEntityManagerFactoryBean entityManager = new LocalContainerEntityManagerFactoryBean(); if (config.isJtaDatasource()) { entityManager.setJtaDataSource(config.getDataSource()); } else { entityManager.setDataSource(config.getDataSource()); } Properties p = new Properties(); p.putAll(config.getJpaProperties()); if (jpaParamsList != null) { for (JPAParams jpaParams : jpaParamsList) { p.putAll(jpaParams.getProperties()); } } entityManager.setJpaProperties(p); entityManager.setPackagesToScan(config.getPackageToScan()); entityManager.setPersistenceProvider(new HibernatePersistenceProvider()); return entityManager; } After a lot of debugging, it looks like the entitymanager is being closed by spring. This seems to happen because EntityManagerHolder gets registered with the transaction synchronization, but I would have though this should only happen in the case of a JPA transaction but NOT when JTA is used ........... going to continue investigating at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:347)

      at com.sun.proxy.$Proxy44.close()
    2. com.sun.proxy
      $Proxy44.close
      1. com.sun.proxy.$Proxy44.close(Unknown Source)
      1 frame
    3. Spring ORM
      EntityManagerFactoryUtils$TransactionalEntityManagerSynchronization.releaseResource
      1. org.springframework.orm.jpa.EntityManagerFactoryUtils.closeEntityManager(EntityManagerFactoryUtils.java:438)
      2. org.springframework.orm.jpa.EntityManagerFactoryUtils$TransactionalEntityManagerSynchronization.releaseResource(EntityManagerFactoryUtils.java:511)
      3. org.springframework.orm.jpa.EntityManagerFactoryUtils$TransactionalEntityManagerSynchronization.releaseResource(EntityManagerFactoryUtils.java:456)
      3 frames
    4. Spring Tx
      TransactionTemplate.execute
      1. org.springframework.transaction.support.ResourceHolderSynchronization.beforeCompletion(ResourceHolderSynchronization.java:77)
      2. org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCompletion(TransactionSynchronizationUtils.java:106)
      3. org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCompletion(AbstractPlatformTransactionManager.java:945)
      4. org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:745)
      5. org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730)
      6. org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:150)
      6 frames