11

We are trying to deploy a Java 7 Spring MVC application using Hibernate into an IBM WebSphere 8.5.5.2 server. The application runs fine on a Tomcat server, but we cannot get it running in WebSphere.

The stack trace output is the following:

[3/26/15 13:49:53:552 MDT] 00000066 AutowiredAnno I org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor <init> JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
[3/26/15 13:49:54:299 MDT] 00000066 LocalContaine I org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean createNativeEntityManagerFactory Building JPA container EntityManagerFactory for persistence unit 'default'
[3/26/15 13:49:54:339 MDT] 00000066 LogHelper     Z org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]
[3/26/15 13:49:54:536 MDT] 00000066 Version       Z org.hibernate.Version logVersion HHH000412: Hibernate Core {4.3.7.Final}
[3/26/15 13:49:54:543 MDT] 00000066 Environment   Z org.hibernate.cfg.Environment <clinit> HHH000206: hibernate.properties not found
[3/26/15 13:49:54:546 MDT] 00000066 Environment   Z org.hibernate.cfg.Environment buildBytecodeProvider HHH000021: Bytecode provider name : javassist
[3/26/15 13:49:54:580 MDT] 00000066 JarInputStrea Z org.hibernate.jpa.boot.archive.internal.JarInputStreamBasedArchiveDescriptor visitArchive HHH015010: Unable to find file (ignored): bundleresource://130.fwk-1163147521/
                                 java.lang.NullPointerException: in is null
    at java.util.zip.ZipInputStream.<init>(ZipInputStream.java:111)
    at java.util.zip.ZipInputStream.<init>(ZipInputStream.java:90)
    at java.util.jar.JarInputStream.<init>(JarInputStream.java:87)
    at java.util.jar.JarInputStream.<init>(JarInputStream.java:73)
    at org.hibernate.jpa.boot.archive.internal.JarInputStreamBasedArchiveDescriptor.visitArchive(JarInputStreamBasedArchiveDescriptor.java:73)
    at org.hibernate.jpa.boot.scan.spi.AbstractScannerImpl.scan(AbstractScannerImpl.java:72)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.scan(EntityManagerFactoryBuilderImpl.java:725)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:221)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:188)
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider$1.<init>(SpringHibernateJpaPersistenceProvider.java:49)
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:49)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1627)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1564)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:540)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:956)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:747)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1686)
    at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:414)
    at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
    at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1177)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
    at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:776)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl$5.run(ApplicationMgrImpl.java:2195)
    at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5474)
    at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5600)
    at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2200)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:446)
    at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:389)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:117)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:995)
    at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:502)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1864)

[3/26/15 13:49:54:899 MDT] 00000066 Version       Z org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
[3/26/15 13:49:55:511 MDT] 00000066 Enhance       E   CWWJP9992E: openjpa.Enhance: Error: The identity field defined in the com.company.model.KeyValueMapping Embeddable is not supported. 
[3/26/15 13:49:55:837 MDT] 00000066 Dialect       Z org.hibernate.dialect.Dialect <init> HHH000400: Using dialect: org.hibernate.dialect.SQLServer2008Dialect
[3/26/15 13:49:55:864 MDT] 00000066 LobCreatorBui Z org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
[3/26/15 13:49:56:071 MDT] 00000066 AnnotationCon W org.springframework.context.support.AbstractApplicationContext refresh Exception encountered during context initialization - cancelling refresh attempt
                                 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in com.company.WebConfig: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax/persistence/Table.indexes()[Ljavax/persistence/Index;
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:540)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:956)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:747)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1686)
    at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:414)
    at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
    at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1177)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
    at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:776)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl$5.run(ApplicationMgrImpl.java:2195)
    at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5474)
    at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5600)
    at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2200)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:446)
    at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:389)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:117)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:995)
    at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:502)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1864)
Caused by: java.lang.NoSuchMethodError: javax/persistence/Table.indexes()[Ljavax/persistence/Index;
    at org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:973)
    at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:824)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3845)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3799)
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1412)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:852)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:845)
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:844)
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1627)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1564)
    ... 37 more

Thank you!

Gas
  • 17,601
  • 4
  • 46
  • 93
npiani
  • 515
  • 1
  • 9
  • 26
  • What version of JPA are you using? Check if it is supported by WAS version. – kmansoor Apr 06 '15 at 17:20
  • 1
    @kmansoor We were using 2.1, and that was causing issues. We lowered it to 2.0 and got past that. – npiani Apr 06 '15 at 17:23
  • When you added hibernate-entitymanager 4.3 this brought the newer spec (2.1) and a different factory provider for the entitymanager. Basically you ended up having both jars in the classpath as transitive dependencies. ....from...http://stackoverflow.com/questions/20734540/nosuchmethoderror-in-javax-persistence-table-indexesljavax-persistence-index – kmansoor Apr 06 '15 at 17:31
  • can you verify your EM version? Check your pom.xml (if using maven) – kmansoor Apr 06 '15 at 17:33
  • 1
    Actually, the issue may be that the method in question is not found in JPA 2.0. The docs says it is available since 2.1 – kmansoor Apr 06 '15 at 17:35
  • @kmansoor So we cannot use Hibernate 4.3.7 with JPA 2.0. Is that correct? But JPA 2.1 from what I can find is not compatible with WAS 8.5.5.2. – npiani Apr 06 '15 at 20:00

6 Answers6

10

I share what worked for me. Me and my team were able to deploy our application with Spring 4.2.4, Hibernate 5.1 and Hibernate JPA 2.1 in Websphere 8.5.5 and Websphere 7.

The key to do this is to extract all the hibernate libraries and put them in a shared library folder in your server, create in your server configuration a new class loader with parent last order and assign to this class loader the shared library containing the hibernate libraries. Then you must change the Default Java Persistence API settings to use the hibernate persistence provider and not the default WebSphere persistence provider. So the steps are the followings:

  1. Create a folder in your server and put in it all the hibernate libraries

    enter image description here

  2. Create the shared library in Websphere (Environment / Shared libraries) and set it to the path of the folder you just created on the server

  3. On WebSphere click on your server and under Server Infrastructure click on Java and Process Management / Class Loader. Click on New and select the Parent Last option. Save

    enter image description here

  4. Click on the new class loader you just created and click on Shared library references on the right. Here add the shared library containing the Hibernate Libraries

  5. Now under the section Container Settings of your server click on Container Services / Default Java Persistence API settings. Here you have to specify an alternate default persistence provider. See the image below.

    enter image description here

  6. Now compile your application and remove from the generated war the Hibernate libraries (see image 1). Then install it in the server.

In my case the application works like a charm also in WebSphere 7. This procedure solves javax/persistence/Table.indexes() error and all the other compilation error caused by libraries conflict between WebSphere and Hibernate.

Reference:

https://www.ibm.com/developerworks/community/wikis/form/anonymous/api/wiki/53181ccd-bcd4-431f-b968-0b5f6d46d652/page/192a432b-28bb-4080-b037-345e5d83da76/attachment/61e74f67-1d60-4120-ba25-ad7264c9f4f6/media/AlternateJPAProviders_TestReport.pdf

amicoderozer
  • 2,046
  • 6
  • 28
  • 44
  • Just FYI: The linked answer from Gas' answer to this question, contains the following statement: 'If you must use JPA 2.1 and Hibernate you have to override default JPA provider.' – Haxiel Jul 21 '16 at 15:15
  • 1
    More importantly, when going that route, you will be using an ‘application managed persistence provider’ and can no longer rely on the container injecting the Entity Manager. You will have to instantiate it yourself. (As stated in @Gas’ answer.) – ᴠɪɴᴄᴇɴᴛ Sep 02 '16 at 11:35
  • Hi, I'm trying to use your WA for was, but with no avail. + I turned the flag com.ibm.websphere.persistence.ApplicationsExcludedFromJpaProcess ing on (https://www-01.ibm.com/support/docview.wss?uid=swg1PM26361). The server is still trying to run app with jpa2.0. Any ideas? – Ermintar Dec 06 '17 at 14:01
  • @amicoderozer, i followed exact same steps for hibernate 5.2.9 based application war deployment but getting `java.lang.IllegalStateException: org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl@a8288642 is closed`. Can anyone help resolving this issue ? – Haripriya Feb 28 '19 at 11:42
  • @PriyankaW This seems a problem relative to your application and how you handle connections. Probably you close the connection somewhere (https://stackoverflow.com/questions/42538817/org-hibernate-resource-jdbc-internal-logicalconnectionmanagedimpl779de014-is-cl) – amicoderozer Feb 28 '19 at 13:05
  • @amicoderozer, same war working on Tomcat9,JbossEAP7.1. While debugging through hibernate source I found exception trace as - `javax.validation.ValidationException: error during validation of at org.apache.bval.jsr303.ClassValidator.unrecoverableValidationError(ClassValidator.java:526) ~[com.ibm.ws.prereq.beanvalidation.jar:?] at org.apache.bval.jsr303.ClassValidator.validate(ClassValidator.java:169) ~[com.ibm.ws.prereq.beanvalidation.jar:?] at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.validate(BeanValidationEventListener.java:116)` Any idea ? – Haripriya Feb 28 '19 at 13:23
  • @PriyankaW No man I'm sorry I have no idea, you should ask a question! – amicoderozer Feb 28 '19 at 14:51
  • @amicoderozer One last question - had you compiled application against IBM Java SDK 8 ? I am trying to understand if its mandatory to build war using sdk instead of jdk ? – Haripriya Mar 01 '19 at 06:41
  • Hello @amicoderozer i follow your steps but it throws this error `java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/hibernate/jpa/HibernatePersistenceProvider, offset=6` Do you know why? – Sara Selim Jun 07 '20 at 22:10
  • @SaraSelim Usually this error is shown when there is incompatibility between Java versions. Maybe the version you use to compile your app isn't compatible with the version used by Websphere – amicoderozer Jun 08 '20 at 09:23
  • Hello @amicoderozer which java version do you use ? – Sara Selim Jun 09 '20 at 10:04
  • @SaraSelim We used jdk 6, but I changed workplace and don't use Websphere anymore. I don't remember the exact version – amicoderozer Jun 09 '20 at 10:24
9

The javax/persistence/Table.indexes() is from JPA 2.1, WebSphere Application Server traditional 8.5.5.2 is using by default JPA 2.0 (OpenJPA). If you want to use Hibernate you have to override the default provider - check this post for more details.

UPDATE

Yes, you are correct. You cannot override default provider in WebSphere traditional 8.5.5.x with JPA 2.1 as container relies on 2.0 api for initialization.

If you have to use 2.1 you may use it as application managed provider not container managed. So you would need to disable JPA for your application, check this and instead of rely on container on injecting EntityManager, initialize it by your self using API.

The other option would be to consider WebSphere Liberty which supports JPA 2.1 (using EclipseLink) starting from version 8.5.5.6. It should be possible to change provider there since container supports 2.1, however I didn't have time to test it.

You can also upgrade to WebSphere Application Server v9, recently released, which supports JPA 2.1.

Community
  • 1
  • 1
Gas
  • 17,601
  • 4
  • 46
  • 93
2

Thought I would share what worked for me. I was able to use JPA 2.1 and Hibernate 4.3.11 on Websphere 8.5.5.5 by using a custom PersistenceProviderResolver so that the Websphere classes do not interfere with Hibernate https://gist.github.com/jeffsheets/aec3e94870ef903ce7efe33e00563d3c

I based it off of a post found here https://hibernate.atlassian.net/browse/JPA-4

Jeff Sheets
  • 1,181
  • 12
  • 18
  • Do I understand correctly that with the custom PersistenceProviderResolver container managed persistence is maintained (and thus the `EntityManager` can still be injected). – ᴠɪɴᴄᴇɴᴛ Sep 02 '16 at 11:34
  • I'm not sure on the 'container managed persistence'. With that custom resolver it basically doesn't use the classes from Websphere so we can use our own JPA and Hibernate classes. I wasn't using any J2EE style container managed entity beans. Just straight Spring Data w/ JPA annotations – Jeff Sheets Sep 06 '16 at 15:27
2

I made it work with Spring Boot 2.1.4, Hibernate 5.3.9.Final and WAS 8.5.5 without any server-level changes :). The steps are outlined in my article below. Still using JPA 2.1, didn't have to downgrade to JPA 2.0 at all.

[How-to] Deploy Spring Boot 2.x apps on WebSphere 8.5.5

Mr.J4mes
  • 9,168
  • 9
  • 48
  • 90
0

What worked for me is:

In the logs(copied from the OP's log), there is this:

[3/26/15 13:49:54:339 MDT] 00000066 LogHelper     Z org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]

If you notice, it's trying to use the default persistence provider.

As such, if we do not specify explicitly the persistence provider to use, Hibernate is going to use the WAS Persistence Provider(i.e OpenJPA in this case) - and in the case of WebLogic, EclipseLink.

As WAS 8.5.5.x support only JPA 2.0(and JPA 1.0), this will not work and a bunch of errors will appear in the logs(...), such as those posted by the OP.

In order to solve it, i explicitly specified the third party persistence to Hibernate as per this post

I hope this will help someone.

jumping_monkey
  • 5,941
  • 2
  • 43
  • 58
0

I followed the amicoderozer's answer on Websphere 8.5.5. However, I had to do a few more modifications.

  1. Extract JPA libraries into a new shared library

As amicoderozer written, you have to extract the JPA libraries into a new shared library and select the flag Use an isolated class loader for this shared library.

{JPA_LIBS}/antlr-2.7.7.jar
{JPA_LIBS}/byte-buddy-1.10.10.jar
{JPA_LIBS}/classmate-1.3.4.jar
{JPA_LIBS}/dom4j-2.1.3.jar
{JPA_LIBS}/FastInfoset-1.2.15.jar
{JPA_LIBS}/hibernate-commons-annotations-5.1.0.Final.jar
{JPA_LIBS}/hibernate-core-5.4.16.Final.jar
{JPA_LIBS}/hibernate-entitymanager-5.4.16.Final.jar
{JPA_LIBS}/hibernate-jpa-2.1-api-1.0.0.Final.jar
{JPA_LIBS}/hibernate-validator-5.4.3.Final.jar
{JPA_LIBS}/istack-commons-runtime-3.0.7.jar
{JPA_LIBS}/jandex-2.0.5.Final.jar
{JPA_LIBS}/javax.activation-api-1.2.0.jar
{JPA_LIBS}/javax.persistence-api-2.2.jar
{JPA_LIBS}/jaxb-api-2.3.1.jar
{JPA_LIBS}/jaxb-runtime-2.3.1.jar
{JPA_LIBS}/jboss-logging-3.3.2.Final.jar
{JPA_LIBS}/jboss-transaction-api_1.2_spec-1.1.1.Final.jar
{JPA_LIBS}/jpa.txt
{JPA_LIBS}/stax-ex-1.8.jar
{JPA_LIBS}/txw2-2.3.1.jar
{JPA_LIBS}/validation-api-2.0.1.Final.jar
  1. Navigate to "Application servers > your_server > Default Java Persistence API settings" section and access to "Default Java Persistence API". There, click in the radio button "Specify an alternate default persistence provider" and put:

org.hibernate.jpa.HibernatePersistenceProvider

  1. Disable JPA processing at server level creating the JVM variable (Your_Server > Process definition > Java Virtual Machine > Custom properties)

com.ibm.websphere.persistence.ApplicationsExcludedFromJpaProcessing => *

  1. During the installation of your application, select the JPA shared library that you created in the first step

  2. Once you have installed the application, navigate to "Enterprise Applications > Your_APP_name > Manage Modules > YourModule". Finally, select PARENT_LAST on the property "Class loader order"

ivasanpag
  • 149
  • 1
  • 4