code: public static void checkPersistenceXMLValidity ()
    {
      // Check if all persistence.xml files contain valid classes!
      try
      {
        int nCount = 0;
        final Enumeration <URL> aEnum = ClassLoaderHelper.getResources (ClassLoaderHelper.getDefaultClassLoader (),
                                                                        PATH_PERSISTENCE_XML);
        while (aEnum.hasMoreElements ())
        {
          nCount++;
          final URL aURL = aEnum.nextElement ();
          final IMicroDocument aDoc = MicroReader.readMicroXML (new URLResource (aURL));
          if (aDoc == null || aDoc.getDocumentElement () == null)
            throw new IllegalStateException ("No XML file: " + aURL);
          for (final IMicroElement ePU : aDoc.getDocumentElement ().getAllChildElements (PERSISTENCE_NAMESPACE_URI,
                                                                                         "persistence-unit"))
            for (final IMicroElement eClass : ePU.getAllChildElements (PERSISTENCE_NAMESPACE_URI, "class"))
            {
              final String sClass = eClass.getTextContent ();
              if (StringHelper.hasNoTextAfterTrim (sClass))
                throw new IllegalStateException ("Persistence file " + aURL + ": class name is missing!");
              GenericReflection.getClassFromName (sClass.trim ());
            }
        }
        LOGGER.info ("All " + PATH_PERSISTENCE_XML + " files are valid (count=" + nCount + ")");
      }
      catch (final IOException ex)
      {
        // From getResources
        throw new IllegalStateException ("Failed to read " + PATH_PERSISTENCE_XML + " file", ex);
      }
      catch (final ClassNotFoundException ex)
      {
        // If forName fails
        throw new IllegalStateException ("Failed to resolve class", ex);
      }
    }
docs: Read all {@value #PATH_PERSISTENCE_XML} files in the class path and check
  if the referenced classes are in the classpath.
  
  @throws IllegalStateException
  in case of an error