Author | Message |
---|---|
vallabhnaik16
Posts: 9
|
Posted 14:02 Oct 19, 2016 |
Hello Professor, We are trying to connect hibernate with spring, but we are getting error in entity manager. The error says, "org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Error loading class [org.hibernate.jpa.HibernatePersistenceProvider]: problem with class file or dependent class.". We are not understanding why we are getting this error. Please check the screenshot attached. Kindly reply to this topic. Thank you, Vallabh Naik |
cysun
Posts: 2935
|
Posted 14:29 Oct 19, 2016 |
The error message says it couldn't load the HibernatePersistenceProvider class. I'd check the dependencies and see if the versions are correct. |
vallabhnaik16
Posts: 9
|
Posted 14:34 Oct 19, 2016 |
Hello professor, I checked all the versions, and I am using the version as you suggested. But still the same error. |
cysun
Posts: 2935
|
Posted 14:36 Oct 19, 2016 |
Show the full error message and persistence.xml. |
vallabhnaik16
Posts: 9
|
Posted 14:38 Oct 19, 2016 |
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Error loading class [org.hibernate.jpa.HibernatePersistenceProvider]: problem with class file or dependent class. Oct 19, 2016 2:08:17 PM org.apache.catalina.core.StandardContext listenerStart |
cysun
Posts: 2935
|
Posted 14:45 Oct 19, 2016 |
java.lang.UnsupportedClassVersionError: org/hibernate/jpa/HibernatePersistenceProvider : Unsupported major.minor version 52.0 (unable to load class org.hibernate.jpa.HibernatePersistenceProvider) It has something to do with JDK version. Assuming you are running JDK 1.8, try changing the maven-compiler-plugin configuration in pom.xml to <target>1.7</target> or <target>1.8</target>, then do a Maven update project. |
vallabhnaik16
Posts: 9
|
Posted 14:46 Oct 19, 2016 |
It also says, unsupported major.minor version 52.0, though we are using jdk 1.7 |
vallabhnaik16
Posts: 9
|
Posted 14:48 Oct 19, 2016 |
That is already 1.7 . We checked everything about java versioning. Everything is 1.7 |
cysun
Posts: 2935
|
Posted 14:56 Oct 19, 2016 |
Are you having problem with all projects that use Hibernate or just this one? |
vallabhnaik16
Posts: 9
|
Posted 14:59 Oct 19, 2016 |
We are having problem with this (csjobs) project and my project. |
cysun
Posts: 2935
|
Posted 15:04 Oct 19, 2016 |
If you can run other projects that use Hibernate like springmvc and oncourse, then there's something wrong in the project configuration. I'd check pom.xml. Also in Eclipse, in the Java Compiler section of project properties you can see which version of JDK Eclipse is using to build the project. If none of the projects using Hibernate work, it may be because the Hibernate class is compiled with JDK 1.8 compliance (i.e. version 52), in which case you need to upgrade your JDK. |
vallabhnaik16
Posts: 9
|
Posted 15:11 Oct 19, 2016 |
Thank you so much professor. I upgraded java to 1.8. And now it is working. Thank you again for your reply. |