Have you ever done a Google search for a problem you're having and all of the replies you find in various blogs, forums and tutorials say basically the same thing?
Yeah, me too.
That's what I did when looking for the reason why my EclipseLink JPA project wasn't behaving itself as a web app.
Search for this string sometime:
javax.persistence.PersistenceException: No Persistence provider for EntityManager named
And you'll get a fascinating myriad of responses, most of which will tell you where to put your persistence.xml file (META-INF under WEB-INF/classes in the case of a web app, by the way, although typically your IDE will do that for you.) but what if you've done that already?
Some more will tell you to make sure you include the line
in your persistence.xml file and still others will tell you to verify that you're using the same Persistence Unit name in
and the line in code where you're instantiating your EntityManager
emf = Persistence.createEntityManagerFactory("myJPAname");
But what if you've done all of that?
What to do?
Ready for the silly, stupid facepalm solution?
Make sure it's in your servlet container/web server lib folder.
For example, my Tomcat 6.0 has a folder in:
Yeah. Make sure your eclipselink and persistence jar files are in there too.