No Persistence provider for EntityManager named
If you are working on hibernate, then there are two ways to provide the configuration to it. Either you would be using hibernate.cfg.xml
or persistence.xml
In both cases, hibernate would be using the information like the connection string information and classes associated with tables.
If you are using persistence.xml
and you are getting No Persistence provider for EntityManager named error, then there the following would be an issue and here is how you solve those.
1.
The persistence name is either not given or it is misspelled
On your persistence.xml file, look for
and make sure the name is assigned the the correct name that the error is showing as missing
2.
The persistence.xml file cannot be found
In the case of hibernate.cfg.xml
file, it would be placed under resources. But in the case of persistence.xml
it should be placed under resources/META-INF/persistence.xml
The above are the main ones causing the error. Try those along with valid xml notation and those should take care the problem.
Have you ever seen this kind of apache error before and its solution?