Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named
This is so annoying
Hope this helps someone.
- My project structure is as follows . I am using JPA2.0
. ├── pom.xml └── src ├── main │ ├── java │ │ └── se │ │ └── mycomp │ │ ├── UserTest.java │ │ └── domain │ │ └── User.java │ └── resources │ ├── META-INF │ │ └── persistence.xml │ └── log4j.properties └── test └── java
- Compare the case sensitiveness for the Persistence Unit Name.
- If you have JPA2.0 as a dependency, you can go ahead and remove the same
- Check if your provider is
<persistence-unit name="manager1" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider>
Check your pom.xml if you have hibernate entity manager as a dependency.
If needed add the hibernate annotations too . No HARM
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>${hibernate-core-version}</version> </dependency>
Thats it, the errors are gone.
No comments :