5

I have been asked to move my application which is currently running on embeded jetty to websphere. I use Hibernate5.0 Spring Java config, Websphere8.5.5.

My observations:

Websphere uses JPA2.0 and Hibernate 5 uses JPA 2.1, i tried all possible ways to tell websphere to use JPA2.1 with no luck

Things i tried with websphere

  • Changed class loader as parent last at 2 locations
    Applications->Websphere enterprise applications->clicked on application name->class loader and update detection->classloader with local class loader first(parent_last)
    Applications->Websphere enterprise applications->clicked on application name->Manage Modules->clicked on application_Name.war->clas loader order as parent_last
  • Servers->Websphere application servers->server Name->Container services->Default Persitence Api settings->org.Hibernate.jpa.HibernatePersistenceProvider
  • http://www-01.ibm.com/support/docview.wss?uid=swg1PM26361

After every change i restarted the server


Is there any way to make Hibernate 5 and Spring LocalEntityManageFActory to work with JPA 2.0, i tried to exclude the jpa 2.1 from hibernate-entitymanager and addeed jpa 2.0 but LocalEntityManageFActory

Caused by: java.lang.ClassNotFoundException: javax.persistence.Converter
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[?:1.7.0_79]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[?:1.7.0_79]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_79]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[?:1.7.0_79]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[?:1.7.0_79]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[?:1.7.0_79]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[?:1.7.0_79]
at org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor(ClassFileArchiveEntryHandler.java:91) ~[hibernate-core-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.handleEntry(ClassFileArchiveEntryHandler.java:48) ~[hibernate-core-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.boot.archive.internal.ExplodedArchiveDescriptor.processDirectory(ExplodedArchiveDescriptor.java:143) ~[hibernate-core-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.boot.archive.internal.ExplodedArchiveDescriptor.processDirectory(ExplodedArchiveDescriptor.java:118) ~[hibernate-core-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.boot.archive.internal.ExplodedArchiveDescriptor.processDirectory(ExplodedArchiveDescriptor.java:118) ~[hibernate-core-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.boot.archive.internal.ExplodedArchiveDescriptor.processDirectory(ExplodedArchiveDescriptor.java:118) ~[hibernate-core-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.boot.archive.internal.ExplodedArchiveDescriptor.processDirectory(ExplodedArchiveDescriptor.java:118) ~[hibernate-core-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.boot.archive.internal.ExplodedArchiveDescriptor.processDirectory(ExplodedArchiveDescriptor.java:118) ~[hibernate-core-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.boot.archive.internal.ExplodedArchiveDescriptor.visitArchive(ExplodedArchiveDescriptor.java:54) ~[hibernate-core-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.boot.archive.scan.spi.AbstractScannerImpl.scan(AbstractScannerImpl.java:46) ~[hibernate-core-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.boot.model.process.internal.ScanningCoordinator.coordinateScan(ScanningCoordinator.java:75) ~[hibernate-core-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.prepare(MetadataBuildingProcess.java:98) ~[hibernate-core-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:194) ~[hibernate-entitymanager-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:144) ~[hibernate-entitymanager-5.0.1.Final.jar:5.0.1.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:54) ~[spring-orm-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343) ~[spring-orm-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318) ~[spring-orm-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at no.vipps.dnb.p2b.bussvc.config.DatabaseConfiguration.entityManagerFactory(DatabaseConfiguration.java:99) ~[classes/:?]
at no.vipps.dnb.p2b.bussvc.config.DatabaseConfiguration$$EnhancerBySpringCGLIB$$3bab1a12.CGLIB$entityManagerFactory$1(<generated>) ~[spring-core-4.2.1.RELEASE.jar:?]
at no.vipps.dnb.p2b.bussvc.config.DatabaseConfiguration$$EnhancerBySpringCGLIB$$3bab1a12$$FastClassBySpringCGLIB$$69ddca7c.invoke(<generated>) ~[spring-core-4.2.1.RELEASE.jar:?]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:318) ~[spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at no.vipps.dnb.p2b.bussvc.config.DatabaseConfiguration$$EnhancerBySpringCGLIB$$3bab1a12.entityManagerFactory(<generated>) ~[spring-core-4.2.1.RELEASE.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_79]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_79]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_79]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_79]

Can some one help me what exactly i should do i am stuck with from last 3 days :(

Bacteria
  • 8,406
  • 10
  • 50
  • 67
Naresh
  • 187
  • 5
  • 11
  • It's not possible, you have to use a JPA 2.0 compliant implementation (which would be Hibernate 4.2.x). – dunni Dec 02 '15 at 19:55
  • Have you considered using WebSphere Liberty? It support JPA 2.1 as of 8.5.5.6. – Alasdair Dec 02 '15 at 21:29
  • I don't have control on the version :( – Naresh Dec 02 '15 at 22:08
  • 1
    Probably duplicate of http://stackoverflow.com/questions/29476026/deploying-application-using-hibernate-jpa-2-1-to-ibm-websphere-gives-nullpointer. There is a thorough answer with a solution that should help you. – OndroMih Dec 03 '15 at 08:54

0 Answers0