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)

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

Do you know how to solve this issue? Write a tip to help other users and build your expert profile.

Solutions on the web

via Stack Overflow by mitul bhatnagar
, 1 year ago
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
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)
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.(BasePersistenceUnitInfoImpl.java:158)
at weblogic.deployment.PersistenceUnitInfoImpl.(PersistenceUnitInfoImpl.java:46)
at weblogic.deployment.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:349)
at weblogic.deployment.AbstractPersistenceUnitRegistry.loadPersistenceDescriptor(AbstractPersistenceUnitRegistry.java:263)
at weblogic.deployment.ModulePersistenceUnitRegistry.(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)

Users with the same issue

You are the first who have seen this exception. Write a tip to help other users and build your expert profile.

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.