"I read that Meta-inf should be placed under src/main/resources"
Not necessarily. But you're right, it should be on the classpath. With src/main/resources, everything (with maven) in there get put on the classpath without the resources/. Keep in mind the Dynamic Web Project type is not a Maven type project (though it can easily be made so if needed).
"When I create a dynamic web project in Eclipse, I seem to get Meta-Inf placed under the webapp folder, alongside Web-Inf."
Yes that is for the Manifest, just like any other jar has. Not the META-INF for the classpath
" I need to configure a persistence.xml file"
You could manually create a META_INF and put it in the src (no main/resources unless you convert it to a maven project). BUT, the easiest way to configure JPA into your Dynamic Web Project is to:
- Right click on your project and go to properties.
- Find Project facets click it, and Select JPA
- There may be a link at the bottom for more configurations. Click it
- Depending on the JPA implementation, you should configure the implementation in this dialog accordingly.
- Once you're finished, you should see the META-INF in the src with the persistence.xml created for you.
See the javaee tutorial on persistence. It states:
If you package the persistence unit as a set of classes in a WAR file, persistence.xml should be located in the WAR file's WEB-INF/classes/META-INF directory.
If you open the navigator view (Windows -> show view -> navigator) you will see the build dir with the classes/META-INF/persistence.xml