java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction. at org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethodTransactionalTestExecutionListener.java:175)

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • This is similar but not identical to SPR-12245. Our base class tests are annotated as follows: {code:java} @TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class, TransactionalTestExecutionListener.class, DbUnitTestExecutionListener.class }) @DbUnitConfiguration( databaseOperationLookup=ExtendedDatabaseOperationLookup.class, dataSetLoader=ColumnSensingDataSetLoader.class) public abstract class FooTestBase extends AbstractTransactionalJUnit4SpringContextTests implements FooTestInterface {code} ... with an annotated subclass: {code:java} @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(value = "/foo-context-test.xml") @TransactionConfiguration(defaultRollback = true) @Transactional public class FooTest extends FooTestBase { {code} In moving from Spring 4.0 to 4.1 we are seeing many of our tests fail with: {noformat} java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction. at org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethodTransactionalTestExecutionListener.java:175) at org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:249) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:72) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:73) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:217) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83) {noformat}
    via by Alan Boshier,
  • This is similar but not identical to SPR-12245. Our base class tests are annotated as follows: {code:java} @TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class, TransactionalTestExecutionListener.class, DbUnitTestExecutionListener.class }) @DbUnitConfiguration( databaseOperationLookup=ExtendedDatabaseOperationLookup.class, dataSetLoader=ColumnSensingDataSetLoader.class) public abstract class FooTestBase extends AbstractTransactionalJUnit4SpringContextTests implements FooTestInterface {code} ... with an annotated subclass: {code:java} @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(value = "/foo-context-test.xml") @TransactionConfiguration(defaultRollback = true) @Transactional public class FooTest extends FooTestBase { {code} In moving from Spring 4.0 to 4.1 we are seeing many of our tests fail with: {noformat} java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction. at org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethodTransactionalTestExecutionListener.java:175) at org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:249) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:72) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:73) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:217) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83) {noformat}
    via by Alan Boshier,
  • Spring test camel transaction not attaching
    via Stack Overflow by Robbo_UK
    ,
    • java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction. at org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethodTransactionalTestExecutionListener.java:175) at org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:249) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:72) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:73) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:217) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83)
    No Bugmate found.