Error "No persistence.xml file found in project" in Eclipse.
Aim: Create a new project GWT+App engine+Maven
Steps to create this:
Then I get the above error.
The file exists at scr/META-INF/persistence.xml and also war/WEB-INF/classes/META-INF/persistence.xml But is not being found.
Notes: I installed plugins m2e, m2e-wtp and google eclipse plugin
xml configuration. You can use JPA with a very short, basic configuration. You only need a persistence element as the root element and a persistence-unit element with a name attribute.
The persistence. xml file is a standard configuration file in JPA. It has to be included in the META-INF directory inside the JAR file that contains the entity beans. The persistence.
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.
The persistence. xml configuration file is used to configure a given JPA Persistence Unit. The Persistence Unit defines all the metadata required to bootstrap an EntityManagerFactory , like entity mappings, data source, and transaction settings, as well as JPA provider configuration properties.
If you are using eclipse. Try right clicking the Project File -> Build Path -> Configure Build Path
Step 1: Add the folder META-INF to the build path
Step 2: Right click the Project File -> Maven -> Update Project
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With