RCP with JPA [message #489756] |
Mon, 05 October 2009 15:19  |
Eclipse User |
|
|
|
I'm having a really hard time getting an Eclipse RCP application working with java persistence.
I initially created a JPA project called Data. I have one managed class, MyData, from an Oracle database.
I then converted it to a plugin project.
Next I created a new Plug-in project using the wizard. I checked generate an activator....., ....will make contributions to the UI and selected yes to create RCP app.
I added my JPA project, Data, to the plugin dependencies of my RCP app.
In my RCP app i created a new Visual Class using RCP>View as the style. In this class I have a button that selects data from the class in my JPA project. Everything seems to work well. I am able to write the contents of the table to the console.
Next I created an extension to my RCP view. I added it to the views and perspectiveExtensions.
When I run the RCP project and click the button to retrieve the data from my class in the JPA project i get the follwoing error...
!ENTRY org.eclipse.ui 4 0 2009-10-05 14:47:19.562
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NoClassDefFoundError: javax/persistence/Persistence
at mtmpui.Members$1.widgetSelected(Members.java:44)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at mtmpui.Application.start(Application.java:20)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
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:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Caused by: java.lang.ClassNotFoundException: javax.persistence.Persistence
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 27 more
I've added all the EclipseLink jars from my JPA project to my RCP buildpath...
javax.persistence_1.99.0.v200906021518.jar
org.eclipse.persistence.antlr_1.1.2.v20090612-r4475.jar
org.eclipse.persistence.asm_1.1.2.v20090612-r4475.jar
org.eclipse.persistence.core_1.1.2.v20090612-r4475.jar
org.eclipse.persistence.jpa_1.1.2.v20090612-r4475.jar
I've been working at this for almost a week and I don't know what to try next. I've tried searching the web and the only thing I found said that you need to separate the data into a JPA plugin project and add it as a plugin dependency in the RCP app.
|
|
|
|
|
|
|
|
Re: RCP with JPA [message #494269 is a reply to message #492711] |
Thu, 29 October 2009 17:02  |
Eclipse User |
|
|
|
Hey Bill!
> So, in my plugin project, which stores my persistence objects, I added
> the following to MANIFEST.MF...
> Eclipse-BuddyPolicy: registered
> In my RCP application I added the following to MANIFEST.MF...
> Eclipse-RegisterBuddy: <PluginProjectName>
> Still doesn't work and I get the same error.
I recommend having a look at
http://wiki.eclipse.org/EclipseLink/Examples/OSGi/Developing _with_EclipseLink_OSGi_in_PDE.
I've got my rcp applications work well using EclipseLink and without
making use of the buddy-mechanism.
> My RCP Application does not contain a persistence.xml file. Is that ok?
> The persistence.xml file is stored in my plugin project which contains
> my persistence objects.
That should be okay...
HTH,
Oliver
|
|
|
Powered by
FUDForum. Page generated in 0.09035 seconds