persistence provider not found


I use IntelliJ IDEA 10.5 Ultimate. I'm trying to persist using JPA with EclipseLink as persistence provider.
When I run my main class I get the following error:

Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named chapter02PU
     at javax.persistence.Persistence.createEntityManagerFactory(
     at javax.persistence.Persistence.createEntityManagerFactory(
     at com.apress.javaee6.chapter02.Main.main(

I have enabled JPA support according to the IntelliJ help.


<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="" version="2.0">
    <persistence-unit name="chapter02PU" transaction-type="RESOURCE_LOCAL">
            <property name="" value="DERBY"/>
            <property name="eclipselink.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
            <property name="eclipselink.jdbc.url" value="jdbc:derby://localhost:1527/chapter02DB;create=true"/>
            <property name="eclipselink.jdbc.user" value="APP"/>
            <property name="eclipselink.jdbc.password" value="APP"/>
            <property name="eclipselink.ddl-generation" value="create-tables"/>
            <property name="eclipselink.logging.level" value="INFO"/>

My facet configuration:

<component name="FacetManager">
    <facet type="jpa" name="JPA">
        <setting name="validation-enabled" value="true" />
        <setting name="provider-name" value="EclipseLink" />
          <factory-entry name="chapter02PU" />
        <deploymentDescriptor name="persistence.xml" url="file://$MODULE_DIR$/META-INF/persistence.xml" />

My project is a Maven module and I've configured my pom.xml to download the (in my opinion necessary) jar files:

javax.persistence (1.1.0),
eclipselink (1.1.0)
derbyclient (
derby (

The corresponding jar files are now listed as external libraries.

However IntelliJ's JPA support still complained about a missing javax.persistence jar, so I clicked "fix" and now have a javax.persistence.jar in the "lib" folder of the project, too.

The line, IntelliJ is referring to (in the error infos) is:

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

I've found a thread in this forum adressing the same problem (
That thread's founder said he had to add some jars to the application server library. However I don't know whether this should
also help me, as I think I let Maven import all necessary jars.

I really have no more idea how to fix this problem.

Comment actions Permalink

Can you start your pesrsistence provider at all (not using JPA console)? For me the probable reason is either driver abseny on classpath either persistence.xml is in incorrect place

regards, Alex

Message was edited by: Alexander Ashitkin

Comment actions Permalink

How do I find out, if I can start the persistence provider at all?
I thought I can only start it by executing my main.

The persistence.xml is located  in the META-INF directory at project root.
I've attached my project to this answer.

Comment actions Permalink

Hi, Richard.
I see at least 2 problems in your project - eclipselink dependencies couldn't be retrieved from maven repository (you have to put eclipse maven repo it in the pom) and META-INF is in the wrong place (move it under src/main/resources).So,  jpa setup isn't runnable itself.
I hope you took a look at eclipslink and JPA docs to figure out what to do: rulezzz :)

best regads, Alex

Comment actions Permalink

Hi Richard Schubert

I'm Stefan. I have the same problem like you, but I am using the hibernate impl for JPA.

I always get this message No persistence unit with name 'persistenceUnit found during tomcat startup.
My persistence.xml is in the META-INF (actually where its supposed to be and not in the resource folders).

How did solve your problem?


Just in case, i created a screen cast



Please sign in to leave a comment.