1

Hello everyone long story short,i'm using hibernate in my project,i try to deploy my project on WebSphere but it's giving me the error you see in the question title ,as you see in my jars there is no trace of a lower version of jpa 2.0

jars included in my project

but i know that all servers have a version of jpa,and websphere 7 is using 1.0 that i found among it's jars,here is a picture of it,

WebSphere 7 jars

if anyone please knows how to resolve this problem or found this problem before i will be so thankful,thank you in advance, i will leave the full stack trace for more infos :

Caused by: java.lang.NoSuchMethodError: javax/persistence/spi/PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/SharedCacheMode; at org.hibernate.ejb.util.LogHelper.logPersistenceUnitInfo(LogHelper.java:39) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:516) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:288) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1547) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1485) ... 61 more

Comrade Anas
  • 11
  • 1
  • 6

1 Answers1

1

I had a similar problem deploying my application with jpa 2.1 in Websphere 7.

If is the same problem, you have to tell Websphere to use Hibernate persistance provider instead of Default Persistance provide.

I wrote a guide with the solution that worked for me in this answer:

https://stackoverflow.com/a/38505479/6503002

EDIT: (Explain step 1 and 2 of the guide)

Step 1: To create a folder you have to access to server machine (through ssh) and create it in the file system (e.g. /usr/sharedHibernate assuming your server runs on linux). Then copy hibernate libraries in the folder you created (from your local machine to the server, with Filezilla or WinScp or Putty).

Step 2: In Websphere console on the left you have Environment section that contains Shared Libraries subsection:

Websphere console

Here create a new shared library, give it the name you want and in classpath textarea insert the path of the folder you created before (e.g. /usr/sharedHibernate)

Shared libraries

amicoderozer
  • 2,046
  • 6
  • 28
  • 44
  • i would love to but the steps aren't so clear for me as i'm veeery new to the websphere and i'm only working on it due to a special demand from the company i'm having my internship in,if you can contact me on skype to explain the steps in a better way to me i will be thankful,thanks. – Comrade Anas Aug 01 '17 at 15:46
  • can you please explain to me the first and second step? – Comrade Anas Aug 01 '17 at 20:34
  • thanks for your help,but i'm only working on my localhost where should i create that hibernate file with the jars? – Comrade Anas Aug 02 '17 at 09:01
  • ah ok i'm sorry, i didn't understand you were working locally. I never use websphere 7 locally, but according to this link https://stackoverflow.com/questions/7792963/how-to-use-javax-persistence-spi-persistenceunitinfo-getvalidationmode-with-wa it's possible to configure another jpa provider. You have to access to the administration console. It should be available at this url http://localhost:9060/ibm/console/. This question may help you to access it: https://stackoverflow.com/questions/13712154/how-to-connect-to-websphere-7-admin-console-or-how-to-view-error-logs-if-its-n – amicoderozer Aug 02 '17 at 09:12