title: java.lang.ClassNotFoundException: org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
body: <p>I've tried to run a test like this in my project, but there is always one error as above in title. I've already read answers, that I should add provider or resources or change the location of the <code>persistence.xml</code> but the location is fine and it doesn't help!</p>
  
  <pre><code>public class Test {
      private static final String DEFAULT_USER_STATUS = "registered";
  
      public static void main(String[] args) {
          EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("JFPersistenceUnit");
          EntityManager entityManager = entityManagerFactory.createEntityManager();
  
          Status e3 = entityManager.find(Status.class, 1);
          System.out.println(e3.getStatusName());
  
          Status status = (Status)entityManager.createQuery("SELECT s FROM Status s WHERE s.statusName =:status")
              .setParameter("status", DEFAULT_USER_STATUS)
              .getSingleResult();
  
          System.out.println(status.getStatusName());
  
          User user = (User)entityManager.createQuery("SELECT u FROM User u WHERE u.nickName =:nickName")
              .setParameter("nickName", "teddy")
              .getSingleResult();
  
          System.out.println(user.getLastName());
  
          entityManager.close();
          entityManagerFactory.close();
      }
  }
  </code></pre>
  
  <p>the <code>persistence.xml</code> file contents:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"&gt;
      &lt;persistence-unit name="JFPersistenceUnit" &gt;
          &lt;!--transaction-type="JTA" —&gt;
          &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
          &lt;!-jta-data-source&gt;JFResources&lt;/jta-data-source--&gt;
          &lt;class&gt;ru.javafiddle.jpa.entity.Access&lt;/class&gt;
          &lt;class&gt;ru.javafiddle.jpa.entity.File&lt;/class&gt;
          &lt;class&gt;ru.javafiddle.jpa.entity.Group&lt;/class&gt;
          &lt;class&gt;ru.javafiddle.jpa.entity.Hash&lt;/class&gt;
          &lt;class&gt;ru.javafiddle.jpa.entity.Library&lt;/class&gt;
          &lt;class&gt;ru.javafiddle.jpa.entity.LibraryToProject&lt;/class&gt;
          &lt;class&gt;ru.javafiddle.jpa.entity.Project&lt;/class&gt;
          &lt;class&gt;ru.javafiddle.jpa.entity.User&lt;/class&gt;
          &lt;class&gt;ru.javafiddle.jpa.entity.UserGroup&lt;/class&gt;
          &lt;class&gt;ru.javafiddle.jpa.entity.Status&lt;/class&gt;
          &lt;class&gt;ru.javafiddle.jpa.entity.Type&lt;/class&gt;
          &lt;exclude-unlisted-classes&gt;false&lt;/exclude-unlisted-classes&gt;
          &lt;properties&gt;&lt;/properties&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>the <code>pom.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0    http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;groupId&gt;ru.javafiddle.ejb&lt;/groupId&gt;
  &lt;artifactId&gt;JavaFiddle-ejb&lt;/artifactId&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
          &lt;version&gt;4.2.2.Final&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;4.2.2.Final&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;postgresql&lt;/groupId&gt;
          &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
          &lt;version&gt;9.1-901.jdbc4&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax&lt;/groupId&gt;
          &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;
          &lt;version&gt;7.0&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  &lt;/properties&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.3&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.8&lt;/source&gt;
                  &lt;target&gt;1.8&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <p>What can I do with all this stuff? The server is correctly deployed, I'm only trying to check the connection to my database and test some queries. The error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError:    org/eclipse/persistence/exceptions/PersistenceUnitLoadingException
  at java.lang.Class.getDeclaredConstructors0(Native Method)
  at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
  at java.lang.Class.getConstructor0(Class.java:3075)
  at java.lang.Class.newInstance(Class.java:412)
  at javax.persistence.spi.PersistenceProviderResolverHolder$DefaultPersistenceProviderResolver.getPersistenceProviders(PersistenceProviderResolverHolder.java:99)
  at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:75)
  at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
  at Test.main(Test.java:19)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:497)
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
  Caused by: java.lang.ClassNotFoundException:  org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
  at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  ... 13 more
  </code></pre>
  
  <p>It occurs in place of calling the function: createEntityManagerFactory("JFPersistenceUnit")</p>
  
  <p>UPDATE: I have no idea why it is said, that is smth wrong with eclipse, when I'm using only hibernate.</p>