java.lang.ClassCastException: org.hibernate.jpa.HibernatePersistenceProvider cannot be cast to javax.persistence.spi.PersistenceProvider. These are the following things I have already completed. Create a new version of Hibernate Library Upgrade my JodaTime library Add the JPA & Persistance upgrade for server to accept JPA 2.0 (Although we will be using our own libraries). set PRE_CLASSPATH=%BEA_HOME%\modules\javax.persistence_1.0.0.0_2-0-0.jar;%BEA_HOME%\modules\com.oracle.jpa2support_1.0.0.0_2-1.jar;%PRE_CLASSPATH% Changed the persistance.xml Persistance.xml <?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns /persistence/persistence_1_0.xsd"> <persistence-unit name="BagTagAgentEJB" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> <jta-data-source>jdbc/GuestSelfService</jta-data-source> <class>hibernate.DataAccessObject.bla</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" > /> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup" /> </properties> </persistence-unit> </persistence> weblogic-application.xml <wls:prefer-application-packages> <wls:package-name>antlr.*</wls:package-name> <wls:package-name>javassist.*</wls:package-name> <wls:package-name>org.dom4j.*</wls:package-name> <wls:package-name>org.apache.commons.collections.*</wls:package-name> <wls:package-name>org.apache.log4j.*</wls:package-name> <wls:package-name>org.hibernate.*</wls:package-name> <wls:package-name>javax.persistence.*</wls:package-name> <wls:package-name>org.joda.*</wls:package-name> <wls:package-name>org.slf4j.*</wls:package-name> </wls:prefer-application-packages> I'm getting the following error at the time of deployment <12/01/2015 2:49:01 PM EST> at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:469)

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

    • java.lang.ClassCastException: org.hibernate.jpa.HibernatePersistenceProvider cannot be cast to javax.persistence.spi.PersistenceProvider. These are the following things I have already completed. Create a new version of Hibernate Library Upgrade my JodaTime library Add the JPA & Persistance upgrade for server to accept JPA 2.0 (Although we will be using our own libraries). set PRE_CLASSPATH=%BEA_HOME%\modules\javax.persistence_1.0.0.0_2-0-0.jar;%BEA_HOME%\modules\com.oracle.jpa2support_1.0.0.0_2-1.jar;%PRE_CLASSPATH% Changed the persistance.xml Persistance.xml <?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml
    • s/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml
    • s/persistence http://java.sun.com/xml
    • s /persistence/persistence_1_0.xsd"> <persistence-unit name="BagTagAgentEJB" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> <jta-data-source>jdbc/GuestSelfService</jta-data-source> <class>hibernate.DataAccessObject.bla</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" > /> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup" /> </properties> </persistence-unit> </persistence> weblogic-application.xml <wls:prefer-application-packages> <wls:package-name>antlr.*</wls:package-name> <wls:package-name>javassist.*</wls:package-name> <wls:package-name>org.dom4j.*</wls:package-name> <wls:package-name>org.apache.commons.collections.*</wls:package-name> <wls:package-name>org.apache.log4j.*</wls:package-name> <wls:package-name>org.hibernate.*</wls:package-name> <wls:package-name>javax.persistence.*</wls:package-name> <wls:package-name>org.joda.*</wls:package-name> <wls:package-name>org.slf4j.*</wls:package-name> </wls:prefer-application-packages> I'm getting the following error at the time of deployment <12/01/2015 2:49:01 PM EST> at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:469) at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199) at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52) at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159) at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:45) at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:648) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52) at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191) at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:59) at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154) at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:208) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217) at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747) at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216) at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250) at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46) at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221) Caused by: weblogic.deployment.EnvironmentException: Error processing persistence unit BagTagAgentEJB of module BagTagAgentEJB-1.0.0-SNAPSHOT.jar: Error instantiating the Persistence Provider class org.hibernate.jpa.HibernatePersistenceProvider of the PersistenceUnit BagTagAgentEJB: java.lang.ClassCastException: org.hibernate.jpa.HibernatePersistenceProvider cannot be cast to javax.persistence.spi.PersistenceProvider at weblogic.deployment.BasePersistenceUnitInfoImpl.getPersistenceProvider(BasePersistenceUnitInfoImpl.java:375) at weblogic.deployment.BasePersistenceUnitInfoImpl.initializeEntityManagerFactory(BasePersistenceUnitInfoImpl.java:393) at weblogic.deployment.BasePersistenceUnitInfoImpl.initializeEntityManagerFactory(BasePersistenceUnitInfoImpl.java:386) at weblogic.deployment.BasePersistenceUnitInfoImpl.<init>(BasePersistenceUnitInfoImpl.java:158) at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:46) at weblogic.deployment.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:349) at weblogic.deployment.AbstractPersistenceUnitRegistry.loadPersistenceDescriptor(AbstractPersistenceUnitRegistry.java:263) at weblogic.deployment.ModulePersistenceUnitRegistry.<init>(ModulePersistenceUnitRegistry.java:69) at weblogic.ejb.container.deployer.EJBModule.setupPersistenceUnitRegistry(EJBModule.java:223) at weblogic.ejb.container.deployer.EJBModule$1.execute(EJBModule.java:324) at weblogic.deployment.PersistenceUnitRegistryInitializer.setupPersistenceUnitRegistries(PersistenceUnitRegistryInitializer.java:62) at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:393)
    No Bugmate found.