Announcement Announcement Module
Collapse
No announcement yet.
error on running tests Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • error on running tests

    hi all...

    i created a class, Item, and added a few attributes (using 'add field'). created new integration test ('new integration test...'). tried running 'mvn test' and ran into error below. The build stated all tests (9 total) ran with no errors or failures. Taking a look at the error, I didn't think the exception was valid, so i'm posting here...

    thanks


    Code:
    Returning eagerly cached instance of singleton bean 'entityManagerFactory' that is not fully initialized yet - a consequence of a circular reference
    BeanConfigurerSupport failed to create target bean 'entityManagerFactory' while configuring object of type [org.mycompany.sample.application.roo.domain.Item] (probably due to a circular reference). Proceeding without injection.
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mycompany.sample.application.roo.domain
    .Item': Injection of persistence fields failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'entityManagerFactory': FactoryBean which is currently in creation returned null from getObject
            at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessAfterInstantiation(PersistenceAnnotationBeanPostProcessor.java:310)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:956)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:333)
            at org.springframework.beans.factory.wiring.BeanConfigurerSupport.configureBean(BeanConfigurerSupport.java:140)
            at org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect.configureBean(AnnotationBeanConfigurerAspect.aj:59)
            at org.springframework.beans.factory.aspectj.AbstractDependencyInjectionAspect.ajc$afterReturning$org_springframework_beans_factory_aspectj_AbstractDependencyInjectionAspect$2$1ea6722c(AbstractDependencyInjectionAspect.aj:89)
            at org.mycompany.sample.application.roo.domain.Item.<init>(Item.java:14)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
            at org.hibernate.engine.UnsavedValueFactory.instantiate(UnsavedValueFactory.java:22)
            at org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifierValue(UnsavedValueFactory.java:44)
            at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
            at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:124)
            at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
            at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
            at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
            at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
            at 
      .......
    
    Static SQL for entity: org.mycompany.sample.application.roo.domain.Item
     Version select: select version from item where id =?
     Snapshot select: select item_.id, item_.version as version0_, item_.comments as comments0_, item_.name as name0_ from i
    tem item_ where item_.id=?
     Insert 0: insert into item (version, comments, name, id) values (?, ?, ?, ?)
     Update 0: update item set version=?, comments=?, name=? where id=? and version=?
     Delete 0: delete from item where id=? and version=?
     Identity insert: insert into item (id, version, comments, name) values (null, ?, ?, ?)
    Static select for entity org.mycompany.sample.application.roo.domain.Item: select item0_.id as id0_0_, item0_.version as version0_0
    _, item0_.comments as comments0_0_, item0_.name as name0_0_ from item item0_ where item0_.id=?
    Static select for entity org.mycompany.sample.application.roo.domain.Item: select item0_.id as id0_0_, item0_.version as version0_0
    _, item0_.comments as comments0_0_, item0_.name as name0_0_ from item item0_ where item0_.id=?
    Static select for entity org.mycompany.sample.application.roo.domain.Item: select item0_.id as id0_0_, item0_.version as version0_0
    _, item0_.comments as comments0_0_, item0_.name as name0_0_ from item item0_ where item0_.id=?
    Static select for entity org.mycompany.sample.application.roo.domain.Item: select item0_.id as id0_0_, item0_.version as version0_0
    _, item0_.comments as comments0_0_, item0_.name as name0_0_ from item item0_ where item0_.id=?
    Static select for entity org.mycompany.sample.application.roo.domain.Item: select item0_.id as id0_0_, item0_.version as version0_0
    _, item0_.comments as comments0_0_, item0_.name as name0_0_ from item item0_ where item0_.id=?
    Static select for action ACTION_MERGE on entity org.mycompany.sample.application.roo.domain.Item: select item0_.id as id0_0_, item0
    _.version as version0_0_, item0_.comments as comments0_0_, item0_.name as name0_0_ from item item0_ where item0_.id=?
    Static select for action ACTION_REFRESH on entity org.mycompany.sample.application.roo.domain.Item: select item0_.id as id0_0_, ite
    m0_.version as version0_0_, item0_.comments as comments0_0_, item0_.name as name0_0_ from item item0_ where item0_.id=?
    initializing class SessionFactoryObjectFactory
    registered: ff80808121363e660121363e67950000 (unnamed)
    Not binding factory to JNDI, no JNDI name configured
    instantiated session factory

  • #2
    Whenever the Roo tests run successfully, you can be assured there is no problem. The tests are very comprehensive and accurately reflect whether the desired persistence operations are working or not.

    The circular reference noted below is a known issue to do with Hibernate. What's happening is Hibernate is instantiating all entities as part of its configuration phase. The instantiation of an entity in turn triggers Spring's @Configurable capability to be used, which attempts to dependency inject the entity. The entity in turn has a @PersistenceContext, which requires the injection of an EntityManager into the entity. The EntityManager cannot yet be injected, as Hibernate is still initialising. Spring understands this loop and dutifully logs it for your information, but it's not a problem.

    Comment


    • #3
      thanks for the quick and detailed response. very much appreciated!

      Comment


      • #4
        I've logged a Jira issue to have this message reviewed or removed from future Spring Framework versions: http://jira.springframework.org/browse/SPR-5752

        Comment

        Working...
        X