org.springframework.beans.factory.BeanCreationException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Hello, Spring can not instantiate the bean EntityManagerFactory with the final version of Hibernate ORM 5.0 Looking at the sources of Hibernate 5.0 RC3 / RC4, I realize that resolvePropertyAccessStrategy method has an additional parameter: containerClass (type: class) https://github.com/hibernate/hibernate-orm/blob/c622d391990969a7d776cf06f565c5934c0d8be4/hibernate-core/src/main/java/org/hibernate/property/access/internal/PropertyAccessStrategyResolverStandardImpl.java Errors : org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContextDb.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.property.access.spi.PropertyAccessStrategyResolver.resolvePropertyAccessStrategy(Ljava/lang/String;Lorg/hibernate/EntityMode;)Lorg/hibernate/property/access/spi/PropertyAccessStrategy; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1045) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:824) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    via by Florian,
  • Hello, Spring can not instantiate the bean EntityManagerFactory with the final version of Hibernate ORM 5.0 Looking at the sources of Hibernate 5.0 RC3 / RC4, I realize that resolvePropertyAccessStrategy method has an additional parameter: containerClass (type: class) https://github.com/hibernate/hibernate-orm/blob/c622d391990969a7d776cf06f565c5934c0d8be4/hibernate-core/src/main/java/org/hibernate/property/access/internal/PropertyAccessStrategyResolverStandardImpl.java Errors : org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContextDb.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.property.access.spi.PropertyAccessStrategyResolver.resolvePropertyAccessStrategy(Ljava/lang/String;Lorg/hibernate/EntityMode;)Lorg/hibernate/property/access/spi/PropertyAccessStrategy; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1045) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:824) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    via by Florian,
  • what kind of error this my First AspectJ
    via Stack Overflow by user2376978
    ,
  • BruceBlog: Using Spring to Send JMS Messages
    via by Unknown author,
  • BruceBlog: Using Spring to Send JMS Messages
    via by Unknown author,
  • Migrating from hibernate 4.3 to hibernate 5.2.8.Final I encountered the following issue: {code} Fatal error org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [META-INF/spring/jpa.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: appPersistenceUnit] Unable to build Hibernate SessionFactory at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1081) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:856) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) ... Caused by: javax.persistence.PersistenceException: [PersistenceUnit: appPersistenceUnit] Unable to build Hibernate SessionFactory at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:967) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:892) at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:151) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:353) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:373) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:362) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ... 15 more Caused by: org.hibernate.PropertyNotFoundException: Could not locate getter method for property [com.myentity.MyEntity#id] at org.hibernate.internal.util.ReflectHelper.findGetterMethod(ReflectHelper.java:420) at org.hibernate.property.access.internal.PropertyAccessBasicImpl.<init>(PropertyAccessBasicImpl.java:41) at org.hibernate.property.access.internal.PropertyAccessStrategyBasicImpl.buildPropertyAccess(PropertyAccessStrategyBasicImpl.java:27) at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:322) at org.hibernate.tuple.PropertyFactory.buildIdentifierAttribute(PropertyFactory.java:63) at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:135) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:519) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:124) at sun.reflect.GeneratedConstructorAccessor146.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:96) at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:77) at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:128) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:297) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:445) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:889) {code} The hibernate mapping is done using hbm.xml files: {code:xml} <class name="com.myentity.MyEntity" table="MY_ENTITY" abstract="true" discriminator-value="null"> <cache usage="transactional"/> <id name="id" column="ID" access="property" type="NumericInteger"> <generator class="com.mygenerator.MyIdGenerator"> <param name="segment_value">MyEntity</param> </generator> </id> <discriminator column="TYPE" type="big_integer" force="true" /> </class> <subclass name="com.myentity.MyRealEntity" extends="com.myentity.MyEntity" discriminator-value="1" lazy="false"> ... </subclass> {code} *MyRealEntity* implements *MyEntity* interface. *MyEntity* interface extends *Common* interface *Common* interface extends *Entity* interface *Entity* interface has getId() and setId(...) Please find a unit test with the issue: {code:java} import org.hibernate.internal.util.ReflectHelper; import org.junit.Test; public class ReflectHelperTest { interface A { String getId(); } interface B extends A { Integer getFoo(); } interface C extends B { String getBar(); } @Test public void testSimpleInheritance() { ReflectHelper.findGetterMethod(B.class, "id"); // this works } @Test public void testIndirectInheritance() { ReflectHelper.findGetterMethod(C.class, "id"); // this doesn't work } } {code}
    via by Jones,
    • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContextDb.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.property.access.spi.PropertyAccessStrategyResolver.resolvePropertyAccessStrategy(Ljava/lang/String;Lorg/hibernate/EntityMode;)Lorg/hibernate/property/access/spi/PropertyAccessStrategy; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1045) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:824) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

    Users with the same issue

    Kawada
    10 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Malcshour
    8 times, last one,
    Unknown visitor1 times, last one,
    216 more bugmates