Skip to content

Compatibility with Hibernate ORM 5.0 Final - create instance of entityManagerFactory [SPR-13391] #17972

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

Closed
spring-projects-issues opened this issue Aug 25, 2015 · 7 comments
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) status: bulk-closed An outdated, unresolved issue that's closed in bulk as part of a cleaning process

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Aug 25, 2015

Florian opened SPR-13391 and commented

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)


Affects: 4.2 GA

Attachments:

Issue Links:

0 votes, 5 watchers

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Spring isn't implementing a PropertyAccessStrategyResolver or the like... This rather seems to be a mismatch between Hibernate jars on your classpath. Could you please double-check that you're actually using all Hibernate jars in the 5.0 Final version?

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Florian commented

I use well all the jars of Hibernate 5.0.
I have no problems with version 5.0 RC3 of Hibernate.
I put the piece attached spring xml configuration file of the bean EntityManagerFactory configuration.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

That configuration looks alright to me. BTW, there is no need to explicitly configure a HibernateJpaDialect if you're setting up a HibernateJpaVendorAdapter anyway.

I suppose the actual stacktrace is longer than shown above? Would be great to see the nested stacktrace of the NoSuchMethodError...

My best guess is still a Hibernate jar mismatch. Maybe an old version of hibernate-entitymanager on your classpath? What does your build setup look like?

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Florian commented

Here the import Maven Hibernate I use :
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>

hibernate.version has 5.0.0.Final value

The stacktrace is already full.
It appears for each scenario cucumber.

I eventually this additional error in the summary of error tests :
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;

I also attached the spring configuration of the datasource for the test execution.

Thanks

@spring-projects-issues
Copy link
Collaborator Author

Florian commented

I solved my problem. Sorry for the inconvenience.

@spring-projects-issues
Copy link
Collaborator Author

Jim Richards commented

@florian - Can you post what your solution was? I'm seeing the same errors.

@spring-projects-issues spring-projects-issues added type: bug A general bug status: waiting-for-triage An issue we've not yet triaged or decided on in: data Issues in data modules (jdbc, orm, oxm, tx) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: bug A general bug label Jan 11, 2019
@rstoyanchev rstoyanchev added status: bulk-closed An outdated, unresolved issue that's closed in bulk as part of a cleaning process and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 11, 2019
@spring-projects-issues
Copy link
Collaborator Author

Bulk closing outdated, unresolved issues. Please, reopen if still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) status: bulk-closed An outdated, unresolved issue that's closed in bulk as part of a cleaning process
Projects
None yet
Development

No branches or pull requests

2 participants