I had the same problem, and I believe you are right about weblogic having it's own version of the JPA interfaces javax.persistence.*
I also tried forcing weblogic to use the newer version deployed within my application by adding the package in weblogic-application.xml :
Code:
<weblogic-application>
<prefer-application-packages>
<package-name>javax.persistence.*</package-name>
</prefer-application-packages>
</weblogic-application>
By doing this I don't get the exception you mention anymore, but now I got a different one:
weblogic.management.DeploymentException:
at weblogic.application.internal.flow.JpaFlow.prepare(JpaFlow.java:59)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:16)
Truncated. see log file for complete stacktrace
weblogic.deployment.EnvironmentException: Error processing persitence unit ApplicationEntityManager of module midas-ear-
1: Error instantiating the Persistence Provider class org.hibernate.ejb.HibernatePersistence of the PersistenceUnit Appl
icationEntityManager: java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persi
stence.spi.PersistenceProvider
at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:322)
at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:123)
at weblogic.deployment.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:331
)
at weblogic.deployment.AbstractPersistenceUnitRegistry.loadPersistenceDescriptors(AbstractPersistenceUnitRegistr
y.java:111)
at weblogic.deployment.EarPersistenceUnitRegistry.<init>(EarPersistenceUnitRegistry.java:52)
I think the issue is that weblogic is not ready to fully support JPA 2.0