MyEclipse: JPA, Plugins, RCP ericrivera - Oct 06, 2011 - 06:53 PM Post subject: JPA, Plugins, RCP
Hi,
I am developing an RCP application that contains multiple plugins. One plugin is JPA capable in order to manage CRUD operations. If I test the code in this plugin with a class with a main in it it works fine. The entities get loaded with the data from the database using the DAOs and the EntityManagerHelper generated by MyEclipse 9.1.
When I run the application as a plugin the following exception is thrown:
java.lang.ClassNotFoundException: javax.persistence.Persistence
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at edu.unmc.cns.condb.model.EntityManagerHelper.<clinit>(EntityManagerHelper.java:20)
at edu.unmc.cns.condb.model.jpa.db.dao.AccountCategoryDAO.findAll(AccountCategoryDAO.java:228)
...
Work with the test class in the JPA plugin running as a Java Application but not when ran as an Eclipse application.
What I am doing wrong?
Thanks,
ericSupport-Brian - Oct 07, 2011 - 06:59 AM Post subject:
Eric,
When you run your application as a standalone Java application, simple dependencies to JAR files (or other projects) are just fine, these modifications go to your .classpath file.
When you run as a plugin, however, you need to modify your plugin's MANIFEST.MF to include these libraries as well as dependencies on other plugins. I'm not sure if you've done this; you can add dependencies from the plugin.xml editor.