java.lang.AssertionError: Data on demand for 'Owner' failed to initialize correctly

Spring JIRA | Tim Kral | 5 years ago
  1. 0

    The entity integration tests automatically created by Roo are failing when run against a Database.com (VMFORCE) database. In this case, I'm using the Spring Petclinic script which includes this: entity --class ~.domain.Pet --testAutomatically entity --class ~.domain.Visit --testAutomatically entity --class ~.domain.AbstractPerson --abstract --mappedSuperclass entity --class ~.domain.Vet --extends ~.domain.AbstractPerson --testAutomatically entity --class ~.domain.Owner --extends ~.domain.AbstractPerson --testAutomatically When I run the integration tests, they fail with the following error: java.lang.AssertionError: Data on demand for 'Owner' failed to initialize correctly at org.junit.Assert.fail(Assert.java:91) at org.junit.Assert.assertTrue(Assert.java:43) at org.junit.Assert.assertNotNull(Assert.java:524) at com.springsource.petclinic.domain.OwnerIntegrationTest_Roo_IntegrationTest.ajc$interMethod$com_springsource_petclinic_domain_OwnerIntegrationTest_Roo_IntegrationTest$com_springsource_petclinic_domain_OwnerIntegrationTest$testCountOwners(OwnerIntegrationTest_Roo_IntegrationTest.aj:31) at com.springsource.petclinic.domain.OwnerIntegrationTest.testCountOwners(OwnerIntegrationTest.java:1) 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:616) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) In this case, the Database.com JPA implementation is an adaption of the Database.com SOAP API. This means that a persisted entity must be committed to the database before it can be found via find(). However, this does not appear to be how the entity integration tests were set up out of the box. What I've observed is that a transaction is created via the TransactionalTestExecutionListener, however, a commit is never executed after a persist (and probably rightfully so for most JPA setups). I'm not enough of a Spring expert to know what to do here. Basically, I want to commit the transaction and run a clean up afterwards. Can I do that with a custom test listener? I'd be happy to attempt a roo patch with some guidance here. Thanks.

    Spring JIRA | 5 years ago | Tim Kral
    java.lang.AssertionError: Data on demand for 'Owner' failed to initialize correctly
  2. 0

    The entity integration tests automatically created by Roo are failing when run against a Database.com (VMFORCE) database. In this case, I'm using the Spring Petclinic script which includes this: entity --class ~.domain.Pet --testAutomatically entity --class ~.domain.Visit --testAutomatically entity --class ~.domain.AbstractPerson --abstract --mappedSuperclass entity --class ~.domain.Vet --extends ~.domain.AbstractPerson --testAutomatically entity --class ~.domain.Owner --extends ~.domain.AbstractPerson --testAutomatically When I run the integration tests, they fail with the following error: java.lang.AssertionError: Data on demand for 'Owner' failed to initialize correctly at org.junit.Assert.fail(Assert.java:91) at org.junit.Assert.assertTrue(Assert.java:43) at org.junit.Assert.assertNotNull(Assert.java:524) at com.springsource.petclinic.domain.OwnerIntegrationTest_Roo_IntegrationTest.ajc$interMethod$com_springsource_petclinic_domain_OwnerIntegrationTest_Roo_IntegrationTest$com_springsource_petclinic_domain_OwnerIntegrationTest$testCountOwners(OwnerIntegrationTest_Roo_IntegrationTest.aj:31) at com.springsource.petclinic.domain.OwnerIntegrationTest.testCountOwners(OwnerIntegrationTest.java:1) 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:616) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) In this case, the Database.com JPA implementation is an adaption of the Database.com SOAP API. This means that a persisted entity must be committed to the database before it can be found via find(). However, this does not appear to be how the entity integration tests were set up out of the box. What I've observed is that a transaction is created via the TransactionalTestExecutionListener, however, a commit is never executed after a persist (and probably rightfully so for most JPA setups). I'm not enough of a Spring expert to know what to do here. Basically, I want to commit the transaction and run a clean up afterwards. Can I do that with a custom test listener? I'd be happy to attempt a roo patch with some guidance here. Thanks.

    Spring JIRA | 5 years ago | Tim Kral
    java.lang.AssertionError: Data on demand for 'Owner' failed to initialize correctly
  3. 0

    user.connect() Does not work. Always throws Exception.

    GitHub | 3 years ago | ghost
    java.lang.AssertionError: The user's modhash should never be null, lest no API methods function properly. (Invoke the connect function to remedy this)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    java tests fail

    GitHub | 2 years ago | btorpey
    java.lang.AssertionError
  6. 0

    :aeron-driver:test FAILED

    GitHub | 2 years ago | maoxianfly
    java.lang.AssertionError

  1. fervidnerd 1 times, last 2 days ago
  2. davidvanlaatum 4 times, last 1 day ago
  3. davidvanlaatum 2 times, last 2 months ago
  4. Jeremy 1 times, last 4 months ago
  5. Александр Пастухов 2 times, last 7 months ago
1 unregistered visitors
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. java.lang.AssertionError

    Data on demand for 'Owner' failed to initialize correctly

    at org.junit.Assert.fail()
  2. JUnit
    Assert.assertNotNull
    1. org.junit.Assert.fail(Assert.java:91)
    2. org.junit.Assert.assertTrue(Assert.java:43)
    3. org.junit.Assert.assertNotNull(Assert.java:524)
    3 frames
  3. com.springsource.petclinic
    OwnerIntegrationTest.testCountOwners
    1. com.springsource.petclinic.domain.OwnerIntegrationTest_Roo_IntegrationTest.ajc$interMethod$com_springsource_petclinic_domain_OwnerIntegrationTest_Roo_IntegrationTest$com_springsource_petclinic_domain_OwnerIntegrationTest$testCountOwners(OwnerIntegrationTest_Roo_IntegrationTest.aj:31)
    2. com.springsource.petclinic.domain.OwnerIntegrationTest.testCountOwners(OwnerIntegrationTest.java:1)
    2 frames
  4. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:616)
    4 frames
  5. JUnit
    InvokeMethod.evaluate
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    4 frames
  6. Spring TestContext
    SpringJUnit4ClassRunner.runChild
    1. org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
    2. org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
    3. org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
    4. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
    4 frames
  7. JUnit
    ParentRunner$2.evaluate
    1. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    2. org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    3. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    4. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    5. org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    6. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    6 frames
  8. Spring TestContext
    RunAfterTestClassCallbacks.evaluate
    1. org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    2. org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    2 frames
  9. JUnit
    ParentRunner.run
    1. org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    1 frame
  10. Spring TestContext
    SpringJUnit4ClassRunner.run
    1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
    1 frame
  11. JUnit4 Runner
    JUnit4TestReference.run
    1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    1 frame
  12. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    5 frames