My Quotes

When U were born , you cried and the world rejoiced
Live U'r life in such a way that when you go

Saturday, January 26, 2013

Persistence Unit not found - JPA- RESOLVED

Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named

This is so annoying

I had been looking for solutions for the same. Here are the pointers for the same

Hope this helps someone.

  1. My project structure is as follows . I am using JPA2.0
  2. .
    ├── pom.xml
    └── src
        ├── main
           ├── java
              └── se
                  └── mycomp
                      └── domain
           └── resources
               ├── META-INF
                  └── persistence.xml
        └── test
            └── java
  3. Compare the case sensitiveness for the Persistence Unit Name.
  4. If you have JPA2.0 as a dependency, you can go ahead and remove the same
  5. Check if your provider is 
  6. <persistence-unit name="manager1" transaction-type="RESOURCE_LOCAL">
    Check your pom.xml if you have hibernate entity manager as a dependency.
    If needed add the hibernate annotations too . No HARM
    Thats it, the errors are gone.

No comments :