java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction.

Spring JIRA | Federico Donnarumma | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    We have a base class for tests annotated like this: {code:java} @TestExecutionListeners(TransactionalTestExecutionListener.class) public class BaseTests {} {code} If we extend that class and annotate the subclass like this... {code:java} @Transactional @TestExecutionListeners(TransactionalTestExecutionListener.class) public class ExtendedTests extends BaseTests {} {code} ... then the following exception is thrown: {noformat} java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction. at org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethod(TransactionalTestExecutionListener.java:174) at org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:249) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:71) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:81) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:216) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:82) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:60) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:67) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:162) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) {noformat}

    Spring JIRA | 3 years ago | Federico Donnarumma
    java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction.
  2. 0

    We have a base class for tests annotated like this: {code:java} @TestExecutionListeners(TransactionalTestExecutionListener.class) public class BaseTests {} {code} If we extend that class and annotate the subclass like this... {code:java} @Transactional @TestExecutionListeners(TransactionalTestExecutionListener.class) public class ExtendedTests extends BaseTests {} {code} ... then the following exception is thrown: {noformat} java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction. at org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethod(TransactionalTestExecutionListener.java:174) at org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:249) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:71) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:81) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:216) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:82) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:60) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:67) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:162) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) {noformat}

    Spring JIRA | 3 years ago | Federico Donnarumma
    java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction.
  3. 0

    GitHub comment 3010#189609925

    GitHub | 1 year ago | deepu105
    java.lang.IllegalStateException: Failed to retrieve PlatformTransactionManager for @Transactional test for test context [DefaultTestContext@64d057ab testClass = AccountResourceIntTest, testInstance = com.mycompany.myapp.web.rest.AccountResourceIntTest@41ecb4f2, testMethod = testRegisterAdminIsIgnored@AccountResourceIntTest, testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@4f01d68d testClass = AccountResourceIntTest, locations = '{}', classes = '{class com.mycompany.myapp.SamplemongoApp}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.IntegrationTest=true}', resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.SpringApplicationContextLoader', parent = [null]]].
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    {code} Results : Tests in error: testDoesntExist(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testSaveManyPeople(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFinderFindAll(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testSavePerson(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindIterableMapsWithQueryAnnotation(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindIterableOfPersonWithQueryAnnotation(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindPaged(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFinderFindById(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFinderCount(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testExists(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindRelationshipEntity(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindPersonWithQueryAnnotation(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFinderFindByIdNonexistent(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindByNamedQuery(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindAllOnGroup(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindAccountByEmailLikeNumber(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindPagedNull(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindPagedDescending(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindIterableMapsWithQueryAnnotation(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testSaveWhenFailOnDuplicateSetToFalse(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindIterableOfPersonWithQueryAnnotation(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindPaged(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testSaveWhenDefaultFailOnDuplicateSetToTrueAllowsUpdates(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindSortedNull(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindSortedDescending(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindPersonWithQueryAnnotation(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindByNamedQuery(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testUpdateSingleRelatedToViaField(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testOneToManyReadOnlyShouldThrowExceptionOnSet(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testRemoveFromOneToManyRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testRelationshipGetEntities(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testRelationshipSetEntitiesShouldThrowException(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testClearFromOneToManyRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testAddToOneToManyRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testRemoveSingleRelatedToViaField(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testSingleRelatedToViaField(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testOneToManyReadOnly(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testDeletePreviousRelationshipOnNewRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testSetOneToManyRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testRetainAllFromOneToManyRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testRemoveAllFromOneToManyRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. multipleRelationshipsOfSameTypeBetweenTwoEntities(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testCreateRelationshipWithAnnotationOnSet(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testCreateIncomingRelationshipWithAnnotationOnSet(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testDeleteRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testGetOneToManyRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testCreateRelationshipWithoutAnnotationOnSet(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testConvertedIterableProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testSetShortProperty(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testDefaultFailOnDuplicateSetToFalseCausesMergeWhenAnotherDuplicateEntityCreated(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testCollectionProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testSetSimpleProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testDefaultFailOnDuplicateSetToTrueSavesCorrectlyWhenUpdating(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testIterableProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testUserConstructor(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testConvertedSetProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testConvertedArrayProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testSetProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testArrayProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testLabels(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testSetShortNameProperty(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testConvertedCollectionProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testTraverseFromGroupToPeople(org.springframework.data.neo4j.rest.integration.RestTraversalTests): Cannot start a new transaction without ending the existing transaction. testTraverseFromGroupToPeopleWithFinder(org.springframework.data.neo4j.rest.integration.RestTraversalTests): Cannot start a new transaction without ending the existing transaction. testTraverseFieldFromGroupToPeople(org.springframework.data.neo4j.rest.integration.RestTraversalTests): Cannot start a new transaction without ending the existing transaction. testTraverseFieldFromGroupToPeopleRelationships(org.springframework.data.neo4j.rest.integration.RestTraversalTests): Cannot start a new transaction without ending the existing transaction. testTraverseFromGroupToPeoplePaths(org.springframework.data.neo4j.rest.integration.RestTraversalTests): Cannot start a new transaction without ending the existing transaction. testTraverseFieldFromGroupToPeopleNodes(org.springframework.data.neo4j.rest.integration.RestTraversalTests): Cannot start a new transaction without ending the existing transaction. testQuerySingleOfTypePerson(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. testQueryList(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. testQueryListWithCustomConverter(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. testQueryWithSpaceInParameter(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. testQueryListOfTypeNode(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. testQueryForObjectAsString(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. testQueryForObjectAsEnum(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. testQueryListOfTypePerson(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. Tests run: 222, Failures: 0, Errors: 76, Skipped: 12 [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Spring Data Neo4j - Parent ........................ SUCCESS [ 0.541 s] [INFO] Spring Data Neo4j ................................. SUCCESS [01:20 min] [INFO] Spring Data Neo4j - AspectJ Advanced Mapping ...... SUCCESS [ 54.850 s] [INFO] Spring Data Neo4j - Transactions .................. SUCCESS [ 4.498 s] [INFO] Spring Data Neo4j - Cross-Store Persistence Support SUCCESS [ 7.724 s] [INFO] Spring Data Neo4j - Rest Binding .................. FAILURE [01:10 min] [INFO] Spring Data Neo4j - Distribution .................. SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 03:39 min [INFO] Finished at: 2015-03-26T07:33:48+01:00 [INFO] Final Memory: 58M/724M {code} StackTrace example (same for all tests): {code} testQueryListOfTypePerson(org.springframework.data.neo4j.rest.support.RestQueryEngineTests) Time elapsed: 0.003 sec <<< ERROR! java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction. at org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethod(TransactionalTestExecutionListener.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.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:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:224) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74) {code}

    Spring JIRA | 2 years ago | Thomas Darimont
    java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction.
  6. 0

    {code} Results : Tests in error: testDoesntExist(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testSaveManyPeople(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFinderFindAll(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testSavePerson(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindIterableMapsWithQueryAnnotation(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindIterableOfPersonWithQueryAnnotation(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindPaged(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFinderFindById(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFinderCount(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testExists(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindRelationshipEntity(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindPersonWithQueryAnnotation(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFinderFindByIdNonexistent(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindByNamedQuery(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindAllOnGroup(org.springframework.data.neo4j.rest.integration.RestFinderTests): Cannot start a new transaction without ending the existing transaction. testFindAccountByEmailLikeNumber(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindPagedNull(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindPagedDescending(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindIterableMapsWithQueryAnnotation(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testSaveWhenFailOnDuplicateSetToFalse(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindIterableOfPersonWithQueryAnnotation(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindPaged(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testSaveWhenDefaultFailOnDuplicateSetToTrueAllowsUpdates(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindSortedNull(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindSortedDescending(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindPersonWithQueryAnnotation(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testFindByNamedQuery(org.springframework.data.neo4j.rest.integration.RestGraphRepositoryTests): Cannot start a new transaction without ending the existing transaction. testUpdateSingleRelatedToViaField(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testOneToManyReadOnlyShouldThrowExceptionOnSet(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testRemoveFromOneToManyRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testRelationshipGetEntities(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testRelationshipSetEntitiesShouldThrowException(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testClearFromOneToManyRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testAddToOneToManyRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testRemoveSingleRelatedToViaField(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testSingleRelatedToViaField(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testOneToManyReadOnly(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testDeletePreviousRelationshipOnNewRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testSetOneToManyRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testRetainAllFromOneToManyRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testRemoveAllFromOneToManyRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. multipleRelationshipsOfSameTypeBetweenTwoEntities(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testCreateRelationshipWithAnnotationOnSet(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testCreateIncomingRelationshipWithAnnotationOnSet(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testDeleteRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testGetOneToManyRelationship(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testCreateRelationshipWithoutAnnotationOnSet(org.springframework.data.neo4j.rest.integration.RestNodeEntityRelationshipTests): Cannot start a new transaction without ending the existing transaction. testConvertedIterableProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testSetShortProperty(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testDefaultFailOnDuplicateSetToFalseCausesMergeWhenAnotherDuplicateEntityCreated(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testCollectionProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testSetSimpleProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testDefaultFailOnDuplicateSetToTrueSavesCorrectlyWhenUpdating(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testIterableProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testUserConstructor(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testConvertedSetProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testConvertedArrayProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testSetProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testArrayProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testLabels(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testSetShortNameProperty(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testConvertedCollectionProperties(org.springframework.data.neo4j.rest.integration.RestNodeEntityTests): Cannot start a new transaction without ending the existing transaction. testTraverseFromGroupToPeople(org.springframework.data.neo4j.rest.integration.RestTraversalTests): Cannot start a new transaction without ending the existing transaction. testTraverseFromGroupToPeopleWithFinder(org.springframework.data.neo4j.rest.integration.RestTraversalTests): Cannot start a new transaction without ending the existing transaction. testTraverseFieldFromGroupToPeople(org.springframework.data.neo4j.rest.integration.RestTraversalTests): Cannot start a new transaction without ending the existing transaction. testTraverseFieldFromGroupToPeopleRelationships(org.springframework.data.neo4j.rest.integration.RestTraversalTests): Cannot start a new transaction without ending the existing transaction. testTraverseFromGroupToPeoplePaths(org.springframework.data.neo4j.rest.integration.RestTraversalTests): Cannot start a new transaction without ending the existing transaction. testTraverseFieldFromGroupToPeopleNodes(org.springframework.data.neo4j.rest.integration.RestTraversalTests): Cannot start a new transaction without ending the existing transaction. testQuerySingleOfTypePerson(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. testQueryList(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. testQueryListWithCustomConverter(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. testQueryWithSpaceInParameter(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. testQueryListOfTypeNode(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. testQueryForObjectAsString(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. testQueryForObjectAsEnum(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. testQueryListOfTypePerson(org.springframework.data.neo4j.rest.support.RestQueryEngineTests): Cannot start a new transaction without ending the existing transaction. Tests run: 222, Failures: 0, Errors: 76, Skipped: 12 [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Spring Data Neo4j - Parent ........................ SUCCESS [ 0.541 s] [INFO] Spring Data Neo4j ................................. SUCCESS [01:20 min] [INFO] Spring Data Neo4j - AspectJ Advanced Mapping ...... SUCCESS [ 54.850 s] [INFO] Spring Data Neo4j - Transactions .................. SUCCESS [ 4.498 s] [INFO] Spring Data Neo4j - Cross-Store Persistence Support SUCCESS [ 7.724 s] [INFO] Spring Data Neo4j - Rest Binding .................. FAILURE [01:10 min] [INFO] Spring Data Neo4j - Distribution .................. SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 03:39 min [INFO] Finished at: 2015-03-26T07:33:48+01:00 [INFO] Final Memory: 58M/724M {code} StackTrace example (same for all tests): {code} testQueryListOfTypePerson(org.springframework.data.neo4j.rest.support.RestQueryEngineTests) Time elapsed: 0.003 sec <<< ERROR! java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction. at org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethod(TransactionalTestExecutionListener.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.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:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:224) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74) {code}

    Spring JIRA | 2 years ago | Thomas Darimont
    java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction.

  1. Andreas Häber 22 times, last 1 month ago
4 unregistered visitors

Root Cause Analysis

  1. java.lang.IllegalStateException

    Cannot start a new transaction without ending the existing transaction.

    at org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethod()
  2. Spring TestContext
    SpringRepeat.evaluate
    1. org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethod(TransactionalTestExecutionListener.java:174)
    2. org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:249)
    3. org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:71)
    4. org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:81)
    5. org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
    5 frames
  3. JUnit
    ParentRunner.runLeaf
    1. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    1 frame
  4. Spring TestContext
    SpringJUnit4ClassRunner.runChild
    1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:216)
    2. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:82)
    2 frames
  5. JUnit
    ParentRunner$2.evaluate
    1. org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    2. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    3. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    4. org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    5. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    5 frames
  6. Spring TestContext
    RunAfterTestClassCallbacks.evaluate
    1. org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:60)
    2. org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:67)
    2 frames
  7. JUnit
    ParentRunner.run
    1. org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    1 frame
  8. Spring TestContext
    SpringJUnit4ClassRunner.run
    1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:162)
    1 frame
  9. JUnit
    JUnitCore.run
    1. org.junit.runner.JUnitCore.run(JUnitCore.java:160)
    1 frame
  10. IntelliJ junit4 module
    JUnit4IdeaTestRunner.startRunnerWithArgs
    1. com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
    1 frame
  11. IDEA
    JUnitStarter.main
    1. com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
    2. com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
    2 frames
  12. Java RT
    NativeMethodAccessorImpl.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    2 frames
  13. IDEA
    AppMain.main
    1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
    1 frame