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
The bug has reappeared for certain Indigo (3.7) versions. See here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=357810
Right-click project -> Maven -> Update Project Configuration...
This might destroy certain buildpath entries and/or the deployment assembly, very annoying, so only do this when changing Maven deps.
To workaround the persistence.xml message until the patch is released, you need to clean the project on many operations as even setting the error level to "ignore" doesn't work. This is a complete bummer.
Whereabouts in your project structure is the file located?
For ref, I have mine in maven-module-name/src/main/resources/META-INF/
In my case it was the Maven plugin which has a bug that sets "Exclude" to . in the Build path for your resources folder. Removing . solved the issue for me
I had the same error, but solved it in a different way.
The thing is that META-INF must be considered a source folder, and as it was under /ejbModule (mine is a EJB project) I assumed it was on the build path. And it wasn't. Actually it was on "exclude" list on build path. So, all I did was right-click the META-INF folder on Project Explorer view and selected INCLUDE on Build Path menu. Then I asked Eclipse to clean the project and everything was right again.
Best Regards.
I came accross the same problem. Goto project properties -> Java build path -> source , remove */.java excluded attribute of src/main/resources source. Then add META-INF/persistence.xml. Then restart eclipse. You should persistence.xml under JPA Content in Project explorer. After that revert your changes.
Well, what I suggest seem stupid, but magically it works. By the way my eclipse version is 3.6.
I figured out what the problem is here.... the JPA Facet is assuming that the META-INF folder is directly under a source folder. If you are using a Maven project, you likely have something like src/main/resources or src/test/resources. If your persistence.xml is under these folders it will complain. If you create a new source folder (call it "jpa") and create a META-INF/persistence.xml in there, then it will find it successfully. (I also had to do a clean/close/open project)
This is certainly a pain.... and I can see many situations this won't work well.