Eclipse does not recognize content of persistence.xml

前端 未结 27 1733
野趣味
野趣味 2021-01-30 20:44

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

相关标签:
27条回答
  • 2021-01-30 20:49

    I've had the same problem on a few occasions and what worked for me was to copy the contents of the file, delete it and create a new persistence.xml file and paste the contents back in.

    0 讨论(0)
  • 2021-01-30 20:49

    The problem has been fixed in Indigo (released in June 2011), see https://bugs.eclipse.org/bugs/show_bug.cgi?id=251323#c24 and https://issues.sonatype.org/browse/MECLIPSEWTP-11.

    The "persistence.xml file does not have recognized content." error might still appear, randomly, on project import or Workspace startup, but it can be fixed with a project clean or maven project update. This will be fixed in Dali in SR2.

    0 讨论(0)
  • 2021-01-30 20:49

    For me it worked once I have cleared all messages from Markers tab in eclipse

    0 讨论(0)
  • 2021-01-30 20:50

    I fixed the problem the following way (I'm using RAD v8.5.1):

    1. Windows --> Preferences --> Validation
    2. Scroll down to "JPA Validator" and click on the Ellipses under Settings.
    3. Click on the "Add Include Group..." button.
    4. Click on the new Include Group that appeared to highlight it.
    5. Click on the "Add Rule..." button.
    6. A dialog menu pops up. Click the "Folder or file name" radio button and click on "Next".
    7. Click on "Browse Folder..." and navigate to your src directory (in my case, it was "src/main/resources") within your project (my project was a .war in a multi module app) in your workspace.
    8. Click on "Finish".
    9. Click on "OK". This will prompt a full build.
    10. The error will go away.
    0 讨论(0)
  • 2021-01-30 20:51

    I had this same problem in Eclipse 3.6 (Helios). The cause was the JPA Facet was set to JPA Version 1.0, however my persistence.xml file was specifying JPA Version 2. So I changed the JPA Facet to version 2.0 and the problem went away. (Project --> Properties --> Project Facets --> "Configuration" drop down --> set this to "Minimal JPA 2.0 configuration"

    0 讨论(0)
  • 2021-01-30 20:51

    I had the same problem, to make it go away I had to make sure this line was the very first line at the top of the file (with no leading empty lines or spaces):

    <?xml version="1.0" encoding="UTF-8"?>
    
    0 讨论(0)
提交回复
热议问题