error: No Persistence provider for EntityManager
725006Sep 29 2009 — edited Sep 30 2009I'm trying to get an Oracle connection to the database. My IDEA seems to recognize the following persistence providers:
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
oracle.toplink.essentials.PersistenceProvider
However, I always get a *"No Persistence provider for EntityManager"* exception when I run my code. My classpath includes:
c3p0-0.9.1.jar
ehcache-1.2.3.jar
toplink-essentials-agent.jar
toplink-essentials.jar
toplink-oc4j.jar
toplink.jar
Here's my persistence.xml file:
<persistence 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"
version="1.0">
<persistence-unit name="Snapshot" transaction-type="RESOURCE_LOCAL">
<!--
<provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
-->
<provider>
oracle.toplink.essentials.PersistenceProvider
</provider>
<mapping-file> (mapping files) </mapping-file>
<class> (classes) </class>
<properties>
<property name="toplink.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>
<property name="toplink.jdbc.url" value="jdbc:oracle:thin:@(ip):1546:ESDD01"/>
<property name="toplink.jdbc.user" value="scott"/>
<property name="toplink.jdbc.password" value="tiger"/>
<property name="toplink.logging.level" value="INFO"/>
<property name="toplink.target-database" value="Oracle"/>
<property name="hibernate.c3p0.min_size" value="5"/>
<property name="hibernate.c3p0.max_size" value="20"/>
<property name="hibernate.c3p0.timeout" value="1800"/>
<property name="hibernate.c3p0.max_statements" value="50"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
</properties>
</persistence-unit>
</persistence>
I have sanitized a few properties.
Why am I getting this error, what does it actually mean, and what should I do? I've been fighting it for days.