Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

No Persistence provider for EntityManager named

843859May 5 2007 — edited Jan 7 2010
I am trying to use Java Persistence API outside a container. I get the following error:
javax.persistence.PersistenceException: No Persistence provider for EntityManager named default
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:89)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
	at com.sita.txns.unmarshal.main(unmarshal.java:25)
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		try {
...
...
		EntityManagerFactory emf = Persistence.createEntityManagerFactory("default");
...
...
		
		} catch (Exception ex) {
			ex.printStackTrace();
		}

	}
<persistence>
    <persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
        <provider>
           oracle.toplink.essentials.PersistenceProvider
        </provider>
        <class>com.sita.txns.persistence.Inventory</class>
        <class>com.sita.txns.persistence.Order</class>
        <class>com.sita.txns.persistence.Item</class>
        <properties>
            <property name="toplink.logging.level" value="FINE"/>
            <property name="toplink.jdbc.driver" value="oracle.jdbc.OracleDriver"/>  <!-- update to match database-->
            <property name="toplink.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:XE;create=true"/> <!-- update to match database-->
            <property name="toplink.jdbc.user" value="sita"/> <!-- update to match database-->
            <property name="toplink.jdbc.password" value="txn"/> <!-- update to match database-->
        </properties>
    </persistence-unit>
</persistence>
Any ideas?????

I have placed the persistence.xml everywhere. The folder it is in is explicitly on the classpath.

I included the toplink jars from oracle.
http://www.oracle.com/technology/products/ias/toplink/jpa/download.html

3RD-PARTY-LICENSE.txt
CDDLv1.0.txt
README
toplink-essentials-agent.jar
toplink-essentials.jar 
Thanks, Paul
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 4 2010
Added on May 5 2007
11 comments
5,442 views