users@glassfish.java.net

Re: No Persistence provider for EntityManager!!!!

From: <glassfish_at_javadesktop.org>
Date: Fri, 12 Jun 2009 05:36:01 PDT

Sorry I don't understand. To recap, what I have done is as follows;
[b]1. netbeans project [/b]
I have created a netbeans Enterprise Application that consists of the following;
a. EnterpriseApplication1-ejb : Contains an Entity class called Products and a DBAO to access a mySQL database
b. EnterpriseApplication1-war : Contains a Web Service that calls logic contained in a.)

In terms of classpath, I have the following setup;
.;%JAVA_HOME%\bin;%JRE_HOME\bin;C:\Program Files\Java\jre6\lib\ext\QTJava.zip;C:\Program Files\NetBeans 6.5\java2\modules\ext\hibernate;

[b]2. Persistence.xml [/b]
The persistence.xml file looks as follows;

  <persistence-unit name="productsPU">
    <jta-data-source>depotDB</jta-data-source>
    <class>org.rich.entities.Products</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <properties/>
  </persistence-unit>

depotDB refers to a data source that accesses a mySQL database. When I go under the covers in netbeans, persistence.xml seems to be in the right place.

[b]3. DBAO Products[/b]
In my database access class, I have the following code

EntityManagerFactory emf = Persistence.createEntityManagerFactory("productsPU");

EntityManager em = emf.createEntityManager();

[b]4. The Result[/b]
When I run the application, I get the following;

Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named productsPU: The following providers:
oracle.toplink.essentials.PersistenceProvider
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
Returned null to createEntityManagerFactory.


As I am relatively new to using netbeans, glassfish and the JPA, I have absolutely no idea what is going on. Sadly, I've spent about 8 hours trying to debug to no avail.

Any pointers would be much appreciated.
[Message sent by forum member 'rwwebb' (rwwebb)]

http://forums.java.net/jive/thread.jspa?messageID=350865