title: Websphere HibernatePersistence incompatible with PersistenceProvider
body: <p><a href="http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/topic/com.ibm.websphere.nd.multiplatform.doc/ae/rovr_specs.html" rel="nofollow">Websphere v8.5.5 supports JPA 2.0</a> out of the box.</p>
  
  <p>I am trying to deploy a WAR to a Websphere v8.5.5 application server. My persistence.xml specifies <code>org.hibernate.ejb.HibernatePersistence</code> as the JPA provider.</p>
  
  <p>I have also set the JPA properties:</p>
  
  <pre><code>jpaProperties.put("hibernate.transaction.factory_class", "org.hibernate.transaction.CMTTransactionFactory");
  jpaProperties.put("hibernate.transaction.manager_lookup_class", "org.hibernate.transaction.WebSphereExtendedJTATransactionLookup");
  jpaProperties.put("jta.UserTransaction", "java:comp/UserTransaction");
  </code></pre>
  
  <p>as outlined <a href="https://www.google.com/search?q=AlternateJPAProviders_TestReport&amp;rlz=1C1AFAB_enUS495US533&amp;oq=AlternateJPAProviders_TestReport&amp;aqs=chrome..69i57j69i60.369j0j7&amp;sourceid=chrome&amp;es_sm=122&amp;ie=UTF-8#q=Alternate+JPA+Providers+Test+Report&amp;spell=1" rel="nofollow">in this PDF presentation</a> and in <a href="http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/topic/com.ibm.websphere.express.doc/ae/tejb_jpa3rdparty.html" rel="nofollow">this IBM topic</a></p>
  
  <p>My application is set to "Parent Last" class loading policy and I have included in the WEB-INF/lib directory the following JARs:</p>
  
  <ul>
  <li>hibernate-jpa-2.0-api-1.0.1.Final.jar</li>
  <li>hibernate-commons-annotations-4.0.2.Final.jar</li>
  <li>hibernate-core-4.2.5.Final.jar</li>
  <li>hibernate-entitymanager-4.2.5.Final.jar</li>
  <li>hibernate-envers-4.2.5.Final.jar</li>
  </ul>
  
  <p>Despite all of this, I still get the following error on application startup:</p>
  
  <pre><code>[4/25/14 15:50:58:534 CDT] 0000007e JPAPUnitInfo  E   CWWJP0015E: An error occurred in the org.hibernate.ejb.HibernatePersistence persistence provider when it attempted to create the container entity manager factory for the fastPersistenceUnit persistence unit. The following error occurred: java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence incompatible with javax.persistence.spi.PersistenceProvider
  at com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory(JPAPUnitInfo.java:1580)
  at com.ibm.ws.jpa.management.JPAPUnitInfo.createEntityManagerFactory(JPAPUnitInfo.java:1406)
  at com.ibm.ws.jpa.management.JPAPxmlInfo.extractPersistenceUnits(JPAPxmlInfo.java:246)
  at com.ibm.ws.jpa.management.JPAScopeInfo.processPersistenceUnit(JPAScopeInfo.java:119)
  at com.ibm.ws.jpa.management.JPAApplInfo.processModulePUs(JPAApplInfo.java:167)
  at com.ibm.ws.jpa.management.AbstractJPAComponent.startingModule(AbstractJPAComponent.java:451)
  at com.ibm.ws.jpa.management.JPAComponentImpl.startingDeployedModule(JPAComponentImpl.java:729)
  at com.ibm.ws.jpa.management.JPAComponentImpl.adjust(JPAComponentImpl.java:549)
  at com.ibm.ws.runtime.component.ApplicationMgrImpl.adjust(ApplicationMgrImpl.java:1069)
  at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectAdjust(DeployedApplicationImpl.java:1394)
  at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:627)
  at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
  at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:774)
  at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1374)
  at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2179)
  at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445)
  at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
  at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388)
  at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116)
  at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:663)
  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.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:677)
  at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:621)
  at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1266)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
  at java.lang.reflect.Method.invoke(Method.java:611)
  at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:69)
  at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
  at java.lang.reflect.Method.invoke(Method.java:611)
  at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:272)
  at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1148)
  at java.security.AccessController.doPrivileged(AccessController.java:298)
  at com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30)
  at sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41)
  at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1142)
  at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:995)
  at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:847)
  at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:783)
  at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335)
  at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
  at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228)
  at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181)
  at com.ibm.ws.management.connector.ipc.CallRouter.route(CallRouter.java:247)
  at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink.doWork(IPCConnectorInboundLink.java:360)
  at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink$IPCConnectorReadCallback.complete(IPCConnectorInboundLink.java:602)
  at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1784)
  at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
  at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
  at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
  at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
  at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
  at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
  at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
  at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
  </code></pre>
  
  <p>Does anyone have any idea how to get rid of this error?</p>