Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Configurable BeanCurrentlyInCreationException logging causing confusion [SPR-5752] #10422

Closed
spring-projects-issues opened this issue May 13, 2009 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented May 13, 2009

Ben Alex opened SPR-5752 and commented

Roo-based applications by default use @Configurable together with @PersistenceContext to cause the automatic injection of an EntityManager into @Entity instances. When used with Hibernate, exceptions such as the following are logged:

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)

These exceptions happen when running Roo integration tests and starting a Servlet container to host the application. They are causing confusion for end users, who assume there is a problem whereas the message is simply informational.

It would be preferable that such messages are not logged, or if they must still be logged, the message be clarified to indicate this is an expected and non-fatal condition due to the interaction between @Configurable, Hibernate and @PersistenceContext.


Affects: 3.0 M3

Reference URL: http://forum.springsource.org/showthread.php?t=71760

Issue Links:

Referenced from: commits 2e0f663

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Alright... As of 3.0 RC1, we're logging this to debug only, with a refined message and without a full stacktrace.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants