when I try to deploy my application on Websphere Application Server 9.0 I got this error
An error occurred in the org.hibernate.jpa.HibernatePersistenceProvider persistence provider when it attempted to create the container entity manager factory for the ApplicationEntityManager persistence unit. The following error occurred: java.lang.ClassCastException: org.hibernate.jpa.HibernatePersistenceProvider incompatible with javax.persistence.spi.PersistenceProvider
and someone suggests me to downgrade my JPA to 2.0. is this possible to use JPA 2.0 with Hibernate 5.2.1. or there is another solution to solve my problem.
If using WebSphere Application Server traditional, here are the instructions to set the JPA spec level provided by the server, https://www.ibm.com/support/knowledgecenter/en/SSEQTP_9.0.0/com.ibm.websphere.base.doc/ae/tejb_idmod_jpaspec.html
That said, Hibernate 5.2.1 appears to have a dependency on JPA 2.1, not 2.0. See the dependencies indicated here, https://mvnrepository.com/artifact/org.hibernate/hibernate-core/5.2.1.Final
The issue might be caused by including a copy of the JPA spec JARs within the application such that the server and the application are trying to load different copies of the same class which collide and produce this error. Check your application and remove all copies of the JPA spec JAR from it (including any supplied by Hibernate), such that the server copy alone is always used to load JPA.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.