title: Eclipse plugin project with eclipselink and derby database
body: <p>I managed to create a java application with eclipselink as shown here </p>
  
  <p><a href="http://www.vogella.com/articles/JavaPersistenceAPI/article.html" rel="nofollow">http://www.vogella.com/articles/JavaPersistenceAPI/article.html</a></p>
  
  <p>But i can not do this with an plugin project. I added derby.jar, eclipselink.jar and java.persistence_2.0.3.jar to the build path. i also added javax.persistence and org.apache.derby.jdbc in the dependencies of the MANIFEST.MF in the dependecies tab as imported packages</p>
  
  <p>and my persistence.xml is in META-INF folder with MANIFEST.MF</p>
  
  <p>My persistence.xml looks like</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;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" xmlns="http://java.sun.com/xml/ns/persistence"&gt;
  &lt;persistence-unit name="todos" transaction-type="RESOURCE_LOCAL"&gt;
  &lt;class&gt;Tutorial.Todo&lt;/class&gt;
  &lt;properties&gt;
      &lt;property name="javax.persistence.jdbc.driver"value="org.apache.derby.jdbc.EmbeddedDriver" /&gt;
      &lt;property name="javax.persistence.jdbc.url" value="jdbc:derby:simpleDb;create=true" /&gt;
      &lt;property name="javax.persistence.jdbc.user" value="test" /&gt;
     &lt;property name="javax.persistence.jdbc.password" value="test" /&gt;
  
  
     &lt;property name="eclipselink.ddl-generation" value="create-tables" /&gt;
     &lt;property name="eclipselink.ddl-generation.output-mode" value="database" /&gt;
       &lt;/properties&gt;
  
  &lt;/persistence-unit&gt;
  </code></pre>
  
  <p></p>
  
  <p>and i call it like this:</p>
  
  <pre><code>private static final String PERSISTENCE_UNIT_NAME = "todos";
  private static EntityManagerFactory factory;
  
  public static void test {
      factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
      EntityManager em = factory.createEntityManager();
      // Read the existing entries and write to console
      Query q = em.createQuery("select t from Todo t");
      List&lt;Todo&gt; todoList = q.getResultList();
      for (Todo todo : todoList) {
          System.out.println(todo);
      }
      System.out.println("Size: " + todoList.size());
  
      // Create new todo
      em.getTransaction().begin();
      Todo todo = new Todo();
      todo.setSummary("This is a test");
      todo.setDescription("This is a test");
      em.persist(todo);
      em.getTransaction().commit();
  
      em.close();
  }
  </code></pre>
  
  <p>The error message i get is:</p>
  
  <pre><code>!ENTRY org.eclipse.osgi 4 0 2012-04-17 20:54:18.568
  !MESSAGE Application error
  !STACK 1
  javax.persistence.PersistenceException: No Persistence provider for EntityManager named todos
  at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
  at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
  at rcptest.Application.start(Application.java:30)
  at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
  at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
  at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
  at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
  An error has occurred. See the log file
  C:\dev\runtime-RcpTest.application\.metadata\.log.
  </code></pre>