Im getting the following error in eclipse:
The persistence.xml file does not have recognized content.
My persistence.xml file works great in my application but e
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
Worked for me!
I got the issue fixed by creating a "symbolic link" in Eclipse. So, my persistence.xml file remains in src/main/resources/META-INF as Maven expects and m2eclipse requires. However, in order to fix the Dali issues, create a new file in src/main/java/META-INF that links to the one in src/main/resources/META-INF. You do this by hitting the "Advanced" options when creating the new file and locating the file using the "Browse..." button. Note that this will not create a physical file in the META-INF folder, however, you need the folder itself in order to create the link.
Hope that works for you.
Hard to say since hard to reproduce (your persistence.xml
is perfectly valid) but maybe try to:
clean
)Ok ... another rather robust solution that worked for me since the top-most ones did not:
since I used Mercurial and could go back easily without any notable differences in the current and last versions it worked this way:
(committed some important changes rather unrelated to this problem)
What I recognized was, that the problem may have been due to the fact that the Java Builder did not generate my war/WEB-INF/classes/
files. The following did not work to follow this trail in letting it build my project:
persistence.xml
or editing it in various wayswhich did not help it as if some internal state could not be changed.
I fixed this by going to Project - Properties - Java Persistence: and then setting the "Source Folder" in the "Canonical metamodel (JPA 2.0)" section to: "src/generated/resources"
I've had the same problem. My solution: right click on the persistence.xml file -> JPA-Tools -> Synchronize Class List. After that it was resolved.