Announcement Announcement Module
Collapse
No announcement yet.
All Integration tests fail. Please help. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • All Integration tests fail. Please help.

    All the integration tests fail in my Roo application. I have posted just one of them here. I am using hsqldb that comes with STS. It is failing to load the ApplicationContext. Can someone recommend a solution?

    -Denis

    -------------------------------------------------------
    T E S T S
    -------------------------------------------------------
    Results :
    Tests in error:

    testCountAllStudents(com.myschool.app.model.Studen tIntegrationTest): Failed to load ApplicationContext
    testFindStudent(com.myschool.app.model.StudentInte grationTest): Failed to load ApplicationContext
    testFindAllStudents(com.myschool.app.model.Student IntegrationTest): Failed to load ApplicationContext
    testFindStudentEntries(com.myschool.app.model.Stud entIntegrationTest): Failed to load ApplicationContext
    testUpdateStudentUpdate(com.myschool.app.model.Stu dentIntegrationTest): Failed to load ApplicationContext
    testSaveStudent(com.myschool.app.model.StudentInte grationTest): Failed to load ApplicationContext
    testDeleteStudent(com.myschool.app.model.StudentIn tegrationTest): Failed to load ApplicationContext
    testMarkerMethod(com.myschool.app.model.StudentInt egrationTest): Failed to load ApplicationContext
    testFlush(com.myschool.app.model.StudentIntegratio nTest): Failed to load ApplicationContext

    Tests run: 135, Failures: 0, Errors: 135, Skipped: 0
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------

    -------------------------------------------------------------------------------
    Test set: com.myschool.app.model.StudentIntegrationTest
    -------------------------------------------------------------------------------
    Tests run: 9, Failures: 0, Errors: 9, Skipped: 0, Time elapsed: 6.303 sec <<< FAILURE!
    testMarkerMethod(com.myschool.app.model.StudentInt egrationTest) Time elapsed: 0.682 sec <<< ERROR!
    java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.TestContext.getAp plicationContext(TestContext.java:157)
    at org.springframework.test.context.web.ServletTestEx ecutionListener.setUpRequestContextIfNecessary(Ser vletTestExecutionListener.java:103)
    at org.springframework.test.context.web.ServletTestEx ecutionListener.prepareTestInstance(ServletTestExe cutionListener.java:73)
    at org.springframework.test.context.TestContextManage r.prepareTestInstance(TestContextManager.java:313)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.createTest(SpringJUnit4ClassRunner.j ava:211)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner$1.runReflectiveCall(SpringJUnit4Clas sRunner.java:288)
    at org.junit.internal.runners.model.ReflectiveCallabl e.run(ReflectiveCallable.java:15)
    at ...

    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExc eptionTranslationPostProcessor#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'entityManagerFactory' defined in file [/Users/denisputnam/MySchool/target/classes/META-INF/spring/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: persistenceUnit] Unable to build EntityManagerFactory
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:532)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 95)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:223)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:292 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:198)
    at org.springframework.context.support.AbstractApplic ationContext.registerBeanPostProcessors(AbstractAp plicationContext.java:741)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:464)
    at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:106)
    at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:57)
    at org.springframework.test.context.support.AbstractD elegatingSmartContextLoader.delegateLoading(Abstra ctDelegatingSmartContextLoader.java:100)
    at org.springframework.test.context.support.AbstractD elegatingSmartContextLoader.loadContext(AbstractDe legatingSmartContextLoader.java:248)
    at org.springframework.test.context.TestContext.loadA pplicationContext(TestContext.java:124)
    at org.springframework.test.context.TestContext.getAp plicationContext(TestContext.java:148)
    ... 30 more
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'entityManagerFactory' defined in file [/Users/denisputnam/MySchool/target/classes/META-INF/spring/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: persistenceUnit] Unable to build EntityManagerFactory
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1486)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:524)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 95)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:223)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:292 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:198)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeansOfType(DefaultListableB eanFactory.java:420)
    at org.springframework.beans.factory.BeanFactoryUtils .beansOfTypeIncludingAncestors(BeanFactoryUtils.ja va:277)
    at org.springframework.dao.support.PersistenceExcepti onTranslationInterceptor.detectPersistenceExceptio nTranslators(PersistenceExceptionTranslationInterc eptor.java:139)
    at org.springframework.dao.support.PersistenceExcepti onTranslationInterceptor.<init>(PersistenceExcepti onTranslationInterceptor.java:79)
    at org.springframework.dao.annotation.PersistenceExce ptionTranslationAdvisor.<init>(PersistenceExceptio nTranslationAdvisor.java:70)
    at org.springframework.dao.annotation.PersistenceExce ptionTranslationPostProcessor.setBeanFactory(Persi stenceExceptionTranslationPostProcessor.java:85)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeAwareMethods(Abst ractAutowireCapableBeanFactory.java:1506)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1474)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:524)
    ... 43 more
    Caused by: javax.persistence.PersistenceException: [PersistenceUnit: persistenceUnit] Unable to build EntityManagerFactory
    at org.hibernate.ejb.Ejb3Configuration.buildEntityMan agerFactory(Ejb3Configuration.java:915)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityMan agerFactory(Ejb3Configuration.java:890)
    at org.hibernate.ejb.HibernatePersistence.createConta inerEntityManagerFactory(HibernatePersistence.java :74)
    at org.springframework.orm.jpa.LocalContainerEntityMa nagerFactoryBean.createNativeEntityManagerFactory( LocalContainerEntityManagerFactoryBean.java:286)
    at org.springframework.orm.jpa.AbstractEntityManagerF actoryBean.afterPropertiesSet(AbstractEntityManage rFactoryBean.java:310)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1545)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1483)
    ... 58 more
    Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.myschool.app.model.BodyOfWork.bodyofwork in com.myschool.app.model.Subject.bodyofworks
    at org.hibernate.cfg.annotations.CollectionBinder.bin dStarToManySecondPass(CollectionBinder.java:708)
    at org.hibernate.cfg.annotations.CollectionBinder$1.s econdPass(CollectionBinder.java:668)
    at org.hibernate.cfg.CollectionSecondPass.doSecondPas s(CollectionSecondPass.java:66)
    at org.hibernate.cfg.Configuration.originalSecondPass Compile(Configuration.java:1597)
    at org.hibernate.cfg.Configuration.secondPassCompile( Configuration.java:1355)
    at org.hibernate.cfg.Configuration.buildSessionFactor y(Configuration.java:1737)
    at org.hibernate.ejb.EntityManagerFactoryImpl.<init>( EntityManagerFactoryImpl.java:94)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityMan agerFactory(Ejb3Configuration.java:905)
    ... 64 more

  • #2
    It appears that I have to delete the *Test_Roo_IntegrationTest.aj files. Based on what I can see in the code, the files are expecting to see data in the database. On a brand new implementation, this is not the case. Is there a configuration item that I need to fix to get the test integration to not test for existing data?

    Comment

    Working...
    X