ObjectDB ObjectDB

Eclipse plugin problem (using ObjectDB as a separate bundle)

#1

Hello support,

I have seen multiple attempts to correct similar errors as in the title above - the latest in the 2.2.8.01 release of objectDb.

However I still get this error.

 

Here is my scenario (Groovy 1.8 and Eclipse 3.6) used.

I have a com.epimss.lab.data.toxicology.TherapeauticDrugScreenRqst. Nested in this class are the following two classes: com.epimss.lab.data.misc.OtherRqst and com.epimss.lab.data.misc.RequestDateAndNumber.

In my Eclipse wizard performFinish() method I persist the TherapeauticDrugScreenRqst data to ObjectDB. For my first attempt at persistence, everything is persisted as expected - I used ObjectDB explorer to view my data.

Now, any other attempt to persist another instance of TherapeauticDrugScreenRqst, with or without restarting my eclipse product results in the following stacktrace:

[ObjectDB 2.2.8_01] javax.jdo.JDOUserException
Attempt to persist a reference to a non managed com.epimss.lab.data.misc.OtherRqst instance (error 637)
at com.objectdb.jpa.EMImpl.commit(EMImpl.java:277)
at javax.jdo.Transaction$commit.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at com.epimss.lab.db.Connection.store(Connection.groovy:261)
at com.epimss.lab.ui.toxicology.TherapeauticDrugScreenRqstWizard.performFinish(TherapeauticDrugScreenRqstWizard.java:170)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:811)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:430)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at com.epimss.lab.handlers.OpenTherapeauticDrugScreenRqstWizardHandler.execute(OpenTherapeauticDrugScreenRqstWizardHandler.java:83)
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.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:47)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:208)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:185)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:101)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:135)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledMenuItemRenderer$1.widgetSelected(HandledMenuItemRenderer.java:150)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:713)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:633)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:106)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:127)
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:369)
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:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
at org.eclipse.equinox.launcher.Main.main(Main.java:1384)

In an attempt to isoloate the problem I cleaned by project, and enhanced with ObjectDB with the small utility class

public class ObjectDbEnhancer
{
    enhanceLabPlugin()
    {
        com.objectdb.Enhancer.enhance( '-s, J:/workspace/epimss/com.epimss.lab/bin-java/com/epimss/lab/data/*.class' )
      
    }
  
    void enhanceSharedPlugin()
    {
        com.objectdb.Enhancer.enhance( '-s, J:/workspace/epimss/com.epimss.shared/bin-java/com/epimss/shared/data/*.class' )
      
    }
  
  
    public static void main( String[] args )
    {
        def app = new ObjectDbEnhancer()
        app.enhanceLabPlugin()
        //        app.enhanceSharedPlugin()
      
    }   // end method main
  
}

Post-enhancement, all files were successfully enhanced.

Here is the contents of the Wizards performFinish method:


@Override
    public boolean performFinish()
    {
        try
        {
            therapeauticDrugScreenRqstWizardPage.getM_bindingContext()
                                                .updateModels();

            therapeauticDrugScreenRqst = therapeauticDrugScreenRqstWizardPage.getTherapeauticDrugScreenRqst();

            RequestDateAndNumber requestDateAndNumber = therapeauticDrugScreenRqstWizardPage.getTherapeauticDrugScreenRqstViewForm()
                                                                                            .getRequestDateAndNumberViewForm()
                                                                                            .getRequestDateAndNumberForm()
                                                                                            .getRequestDateAndNumber();

            therapeauticDrugScreenRqst.setRequestDateAndNumber( requestDateAndNumber );

            OtherRqst otherRqst = therapeauticDrugScreenRqst.getOtherRqst();
            otherRqst.setRequestDateAndNumber( therapeauticDrugScreenRqst.getRequestDateAndNumber() );

            new Connection( ISharedPreference.DB_OBJECTDB, "admin", "admin" ).store( therapeauticDrugScreenRqst );

        }
        catch( Exception e )
        {
            SiAuto.main.logException( "com.epimss.lab.ui.toxicology.TherapeauticDrugScreenRqstWizard.performFinish()", e );

        }   // end try-catch

        return true;

    }   // end method performFinish

Yet, the same stacktrace occurs repeatedly. Why?

edit
delete
#2

In JPA (unlike JDO) persist is not cascaded automatically to referenced objects by default. Therefore, when you persist an object it must reference only objects that are already managed by ObjectDB - otherwise you get this exception.

Alternatively, you can turn cascading persist on - including globally (as in JDO) - see the manual.

ObjectDB Support
edit
delete
#3

Hello support,

I am NOT using JPA. I am using JDO. I have NOT written one line of JPA code!! Setting all cascade-persist properties to true does NOT correct the problem.

 

I noticed that the third line in the stack trace

at com.objectdb.jpa.EMImpl.commit(EMImpl.java:277)



refers to JPA. Is this suppose to be there?

 

How do I set this cascade in JDO?

edit
delete
#4

The stack trace is ok - since some ObjectDB code is common for JPA and JDO.

But actually in JDO cascading persist should be automatic so the exception is unexpected.

Please try changing the configuration:

    <cascade-persist always="true" on-persist="false" on-commit="true" />

If this doesn't help - please submit a test case that reproduces the exception.

ObjectDB Support
edit
delete
#5

Hello support,

It did NOT help.

Attached is a full eclipse e4 product. Unzip and import into your eclise v3.62 workspace. Before attempting to run, download  and update using eclipse using the info on the attached dependencies.png

 

Once all dependencies have been resolved, do the following:

1. Run the application.

2. If the window does not appear and there is a lot of stack trace output go to Run >>Run Configurations...

    Select _com.epimss.lab.product in the left list, then choose Plug-ins tab on the right. Click the Add Required Plug-ins   button on the right (4th button from top), click Validate Plugin-ins button (third on right from below, counting vertically from the "Close" button. Finally click Run (first button on last row)

For the "Groovy" plugin (see update site on attached dependencies.png), once the update is done and eclipse restarted,  select the _com.epimss.lab plugin, right click, select "Configure" in the popup menu and then select "Convert to Groovy Project"

 

3. In the window that appears, click the "Investigations" Menu and then the "Therepeautic Drug Screen". Enter integers in the first 2 text fields and select any dates in the second - all fields are mandatory.

4. Afte 3, any selection will enable the "Finish" button. Clicking the Finish button saves the UI data to ObjectDB. The first Finish does NOT generate any error. Select Investigations again, and repeat the process described before. The error stack trace will be shown the console.

Please let me know what you think is the problem.

 

NB. I could not simply create a simple test because of the OSGi environment

  

 

edit
delete
#6

Please check the update urls and write them here (copy & paste from png doesn't work).

I tried the first (https://launchpad.net/rcptoolbox) and failed.

ObjectDB Support
edit
delete
#7

Sorry,

URLs:

https://launchpad.net/rcptoolbox (if this does NOT open use the attachement below)

 

Update sites:

http://download.eclipse.org/e4/updates/2010 (e4 plugins)

http://dl.google.com/eclipse/inst/d2wbpro/latest/3.6 (WindowBuilder Pro)

http://download.eclipse.org/technology/nebula/cdatetime/update-N/ (Eclipse Nebula CDateTime)

http://download.eclipse.org/technology/nebula/formattedtext/update-N/ (Eclipse Nebula FormattedText)

http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/ (Codehaus Groovy 1.8)

 

Let me know if these are OK.

Thanks

edit
delete
#8

The first url still doesn't work and the whole procedure seems too complex.

Sorry, but I have to ask you to isolate the problem and submit a simple test case.

ObjectDB Support
edit
delete
#9

Hello,

As indicated, if the first URL (NOT an update site) does not work simply drop the attached com.richclientgui.rcptoolbox_1.0.9.jar plugin in the eclipse dropins directory. It will be found when eclipse is restarted.

When I use simple test class, ObjectDb works. However, it is NOT working in my OSGi environment.

Please give it a second try with these instructions:

1. Download eclipse 3.62 from http://download.eclipse.org/eclipse/downloads/drops/R-3.6.2-201102101200/index.php and unzip it into a folder of your choice.

2. Copy and paste com.richclientgui.rcptoolbox_1.0.9.jar from the previous post into the eclipse\dropins directory.

3. Use the eclipse update mechanism to install http://download.eclipse.org/e4/updates/2010

(You might have to select "Contact all update sites during install to find required software for 3. above)

4. Install the other plugins from the update sites:

http://dl.google.com/eclipse/inst/d2wbpro/latest/3.6

http://download.eclipse.org/technology/nebula/cdatetime/update-N/
http://download.eclipse.org/technology/nebula/formattedtext/update-N/
http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/

5. Restart eclipse (Assuming everything works so far)

6. Click (in eclipse) File >> New >> Other

7. Type e4 in the wizards filter text box, then select e4 Application Project.

8. Type _com.epimss.lab as the project's name and src-java and bin-java as the source folder and output folder respectively.

9. Click Next sequetially accepting all defaults and finally click Finish.

10. Simple copy all files from the previously sent atttached _com.epimss.lab plugin to the relevant src-java packages. A source folder MUST be created for the resrc folder.

11. Run the application and follow the previous instructions.

 

Thanks for your patients. I wish I could create the same scenario with a simple test.

 

 

 

edit
delete
#10

Have you tried these steps yourself?

For me it fails on step 3:

Contact all update sites during install to find required software - is enabled.

ObjectDB Support
edit
delete
#11

Hello,

Make certain the Group items by category is selected at the bottom of the page.

Uncheck "E4 Runtime Features" (second in the list)

 

Continue as usual.

 

Thanks again.

edit
delete
#12

Next problems:

  1. http://download.eclipse.org/technology/nebula/cdatetime/update-N/ - doesn't contain categories.
  2. http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/

ObjectDB Support
edit
delete
#13

Hello,

>>Next problems:
>>1. http://download.eclipse.org/technology/nebula/cdatetime/update-N/ - doesn't contain categories.

Uncheck the "Group items by category" - see nebula-cdtime.png attachement.

>>2. http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/

Select "Group items by category", then deselect "Maven integration (optional)" see the "Groovy attachment below"

 

PS: Please let me know how you embed the pictures as above.

Thanks again for your patients.

 

 

edit
delete
#14

In step 8 I get:

Alternatively, I could import the project but then I have problems with the MANIFEST.MF:

Embedding images is currently enabled only for admin (this should be changed) unless you use the Source button and write HTML explicitly.

ObjectDB Support
edit
delete
#15

Looking at your graphic, look closely at 'src-java ' where the error icon is - it seems that you have an extra space after the 'a' in java which is not allowed.

>> Alternatively, I could import the project but then I have problems with the MANIFEST.MF:

This generally is the easier of the two options.

I use objectDB to create a JAR that is compatible with OSGi - it is attaced - use it by importing it after unzipping it.

For both com.objectdb and groovy-all, remove them from the required plugin, then add them back and save.

NB: Remember that you MUST add groovy to the project as described above in "User Post #4" and 2. - then add it in the Required plugin by typing groovy and selecting groovy-all 1.8.

 

Happy to help - keep me posted.

Thanks again

 

edit
delete
#16

There are no errors now - but right click on the project + run as Eclipse Application opens a window with no Investigations.

The console includes:

!SESSION 2011-07-13 23:37:23.812 -----------------------------------------------

eclipse.buildId=M20110210-1200

java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data C:\eclipse-test\workspace/../runtime-EclipseApplication -dev file:C:/eclipse-test/workspace/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86 -consoleLog


!ENTRY org.eclipse.jface 2 0 2011-07-13 23:37:29.781
!MESSAGE Keybinding conflicts occurred.  They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2011-07-13 23:37:29.781
!MESSAGE A conflict occurred for ALT+SHIFT+D G:
Binding(ALT+SHIFT+D G,
ParameterizedCommand(Command(com.google.gdt.eclipse.designer.launch.gwtLaunchShortcut.debug,Debug GWT Application,
  Debug GWT Application,
  Category(org.eclipse.debug.ui.category.run,Run/Debug,Run/Debug command category,true),
  ,
  ,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(ALT+SHIFT+D G,
ParameterizedCommand(Command(org.codehaus.groovy.eclipse.groovyScriptLaunchShortcut.debug,Debug Groovy Script,
  Debug Groovy Script,
  Category(org.eclipse.debug.ui.category.run,Run/Debug,Run/Debug command category,true),
  ,
  ,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
!SUBENTRY 1 org.eclipse.jface 2 0 2011-07-13 23:37:29.781
!MESSAGE A conflict occurred for ALT+SHIFT+X G:
Binding(ALT+SHIFT+X G,
ParameterizedCommand(Command(com.google.gdt.eclipse.designer.launch.gwtLaunchShortcut.run,Run GWT Application,
  Run GWT Application,
  Category(org.eclipse.debug.ui.category.run,Run/Debug,Run/Debug command category,true),
  ,
  ,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(ALT+SHIFT+X G,
ParameterizedCommand(Command(org.codehaus.groovy.eclipse.groovyScriptLaunchShortcut.run,Run Groovy Script,
  Run Groovy Script,
  Category(org.eclipse.debug.ui.category.run,Run/Debug,Run/Debug command category,true),
  ,
  ,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)

Please rewrite the exact running instructions in a new reply (without references to previous posts).

ObjectDB Support
edit
delete
#17

Now that I see the project structure - I would like to refer you to the following forum thread:

http://www.objectdb.com/database/forum/345#item-5

The exception in your project is different so this might be a different problem, but have you tried embedding ObjectDB in your plugin - using ObjectDB as a separate bundle is currently not supported.

ObjectDB Support
edit
delete
#18

The stack trace  might suggests unresolved budles.

To resolve, use the following instructions in the graphic sequentially:

1. select-run-config.png

2. resolve-plugin.png

3. Select the application "Investigations" menu and try the action again.

 

I tried to use objectdb.jar as downloaded as a classpath variable without success.

 

Thanks

edit
delete
#19

OK. It runs now. Second search fails with:

com.epimss.lab.db.Connection.store(instance) java.lang.ClassCastException: _com.epimss.lab.data.toxicology.TherapeauticDrugScreenRqst cannot be cast to com.objectdb.spi.TrackableUserType
at com.objectdb.o.MMM.af(MMM.java:1025)
at com.objectdb.o.UTY.aF(UTY.java:1185)
at com.objectdb.o.UTY.aE(UTY.java:1174)
at com.objectdb.o.ENH.a(ENH.java:46)
at com.objectdb.o.STA.T(STA.java:512)
at com.objectdb.o.STM.D(STM.java:408)
at com.objectdb.o.OBM.bH(OBM.java:884)
at com.objectdb.jdo.PMImpl.bH(PMImpl.java:2186)
at com.objectdb.o.OBM.bG(OBM.java:800)
at com.objectdb.o.OBM.bE(OBM.java:715)
at com.objectdb.jpa.EMImpl.commit(EMImpl.java:274)
at javax.jdo.Transaction$commit.call(Unknown Source)
at _com.epimss.lab.db.Connection.store(Connection.groovy:205)
at _com.epimss.lab.ui.toxicology.TherapeauticDrugScreenRqstWizard.performFinish(TherapeauticDrugScreenRqstWizard.java:167)

This exception is expected due to using ObjectDB in a separate bundle (see this thread).

But on #1 you reported a different exception and stack trace. Where is it?

ObjectDB Support
edit
delete
#20

I applied the solution of this thread to your project, using ObjectDB as an internal reference rather than a separate bundle.

The revised project is attached.

The second search works and in the attached odb file you can see two requests.

The exception at your original post still remains a mystery. Why can't I see it?

ObjectDB Support
edit
delete
#21

 Hello,

I can no longer access the objectdb web site from my desktop.

Have I been accidentally block?smiley

 

I am actually using a different computer for this reply.

Thanks

edit
delete
#22

There were problems with the website in the last hours but they were fixed. Please try again now.

ObjectDB Support
edit
delete
#23

In the plugin you sent me, there is an entry in the .classpath file as shown below:

<classpathentry combineaccessrules="false" kind="src" path="/odb2-rt"/>

However, I don't see a "src" source folder or an odb2-rt jar.

 

edit
delete
#24

I think you can remove it (I prepared source code for debugging).

ObjectDB Support
edit
delete
#25

It works with the embedded objectdb lib - both the test and my development plugin.

Thanks a million - it took a long time but I think we both learn something.

 

edit
delete
#26

OK. That's good.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.