db4o Developer Community

db4o open source object database, native to Java and .NET
Welcome to db4o Developer Community Sign in | Join
in Search
More Search Options

A related Eclipse problem

Last post 07-17-2008, 06:50 AM by dsowerby. 8 replies.
Sort Posts: Previous Next
  •  07-07-2008, 10:48 PM 50038

    A related Eclipse problem

    I've followed the notes at:

    http://developer.db4o.com/Resources/view.aspx/Reference/Platform_Specific_Issues/Database_For_OSGi/Eclipse_Plug-In_With_Db4o_Service

    but got a NoClassDefFoundError: com/db4o/osgi/Db4oService on start up (see below).  I've checked the following and run out of ideas:

     

    1. loaded db4o_osgi.jar into ECLIPSE_HOME
    2. imported as source
    3. db4o_osgi is in the plugin.xml dependencies

    Any idea what I have missed?

     

    org.osgi.framework.BundleException: Exception in uk.co.q3c.deplan.rcp.DePlanRCPPlugin.start() of bundle dePlanRCP.
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1018)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
        at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400)
        at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:417)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:189)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:340)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:408)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:369)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:357)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:289)
        at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:227)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1269)
        at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:160)
        at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:788)
        at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
        at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:165)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
        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:508)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
    Caused by: java.lang.NoClassDefFoundError: com/db4o/osgi/Db4oService
        at uk.co.q3c.deplan.rcp.DePlanRCPPlugin.start(DePlanRCPPlugin.java:35)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993)
        ... 33 more
    Root exception:
    java.lang.NoClassDefFoundError: com/db4o/osgi/Db4oService

     

     

     

     

     

  •  07-08-2008, 11:33 PM 50053 in reply to 50038

    Re: A related Eclipse problem

    I've resolved this particular error - please ignore this post.
  •  07-11-2008, 07:39 PM 50095 in reply to 50053

    Re: A related Eclipse problem

    Great! 

    Can you please give a hint on what the problem was and how to solve it in case others run into the same issue?

    The forum is a valuable tool for users to solve this kind of issues.

    Thanks a lot!


    German Viscuso » db4objects
    W: +1 (650) 515-3615
    F: +1 (650) 240-0421
    M: +1 (650) 863-5474
  •  07-12-2008, 09:30 PM 50101 in reply to 50095

    Re: A related Eclipse problem

    Hi German 

    The thread got broken somewhere ... I had reported the following:

     

    I've followed the notes at:

    http://developer.db4o.com/Resources/view.aspx/Reference/Platform_Specific_Issues/Database_For_OSGi/Eclipse_Plug-In_With_Db4o_Service

    but got a NoClassDefFoundError: com/db4o/osgi/Db4oService on start up (see below).  I've checked the following and run out of ideas:

     

    1. loaded db4o_osgi.jar into ECLIPSE_HOME
    2. imported as source
    3. db4o_osgi is in the plugin.xml dependencies

    I fixed the NoClassDefFoundError by adding the dbo4_ogsi  jars to the classpath, but I'm not sure now  that really solved the problem (or in fact should have done).    I'm trying to run this as an Eclipse RCP plugin, but although I can now start the application the call to context.getServiceReference(Db4oService.class.getName()) returns null, I guess because the service hasn't been started.  Not being familiar with OSGI I've been reading up on that but don't have an answer ... getting db4o to work with Eclipse RCP is proving a real problem, which is a great shame, as it was really easy when I was writing the unit tests for it.

     
    By the way, your OSGI demo looks interesting but I had some problems on Linux with unrar - any chance you could put a zip version up?

     

    David 

     

  •  07-14-2008, 01:57 AM 50110 in reply to 50101

    Re: A related Eclipse problem

    Hi!

    It shouldn't be necessary to add the db4o_osgi bundle jar files to the classpath. I have added a zip version of the OSGiDemo here.

    Please check it out.

    Best.


    German Viscuso » db4objects
    W: +1 (650) 515-3615
    F: +1 (650) 240-0421
    M: +1 (650) 863-5474
  •  07-14-2008, 09:42 PM 50131 in reply to 50110

    Re: A related Eclipse problem

    Hi German

    I did think that adding the jar file to the classpath should be unnecessary, but I couldn't find any other way - it's good to know though, as it confirms that I have an Eclipse problem, not a dbo4 problem.  Maybe it is a good time for me to move to a clean Eclipse 3.4 installation.  Thanks for the response and the zip - it will be a couple of days before I can try 3.4,  but I'll post the results.


    David

  •  07-14-2008, 10:36 PM 50132 in reply to 50131

    Re: A related Eclipse problem

    I couldn't wait, this problem is causing me a real headache!

    I went back to the Wiki explanation, using a fresh install of Eclipse 3.4.  I used db4o 6.3 as the wiki describes, and used the source provided with the article.

    I don't believe I've missed any steps.  db4o_osgi has been imported as source, and the imported db4o_osgi project is in the dependencies of MemoPlugin 

    The example starts up OK with "Sample Menu" and "Sample Action".  When "Sample Action" is selected,  it runs  as far as the Activator.start() method, then the line

    ServiceReference serviceRef = context.getServiceReference(Db4oService.class.getName());

    causes a java.lang.NoClassDefFoundError: com/db4o/osgi/Db4oService  

  •  07-15-2008, 09:45 PM 50153 in reply to 50132

    Re: A related Eclipse problem

    Is the db4o osgi jar file in the eclipse/plugins folder?

    If I follow the instructions here (see "Installation in Eclipse"):

    http://developer.db4o.com/Resources/view.aspx/Reference/Platform_Specific_Issues/Database_For_OSGi/Db4o-Osgi_Usage

    it works for me.

    Best.


    German Viscuso » db4objects
    W: +1 (650) 515-3615
    F: +1 (650) 240-0421
    M: +1 (650) 863-5474
  •  07-17-2008, 06:50 AM 50175 in reply to 50153

    Re: A related Eclipse problem

    It is - I used it to "Import as source".  But I have noticed that the import into db4o_osgi results in only 3 of 4 jars being added to the /lib folder and classpath. db4o-6.3-osgi.jar is missed out for some reason, and it contains the class giving the NoClassDefFoundError (com.db4o.osgi.Db4oService)

     

    I added  db4o-6.3-osgi.jar to /lib and classpath in db4o_osgi and the NoClassDefFoundError is now cleared, but  I get a null returned from  getServiceReference.  I'm wondering whether it would be better to use a ServiceTracker for this - according to the Eclipse FAQs, plugin load order is undefined, in which case the db4o plugin may not have loaded before MemoPlugin.Activator.start() is called.  I don't know, but may be the load order could vary from one set up to another, which would explain why yours works and mine doesn't. I haven't tried the ServiceTracker yet, but will post the results when I have.

    In the meantime, I have tried the direct approach rather than using a service - and that works.  At last!  Many thanks for the help in getting me this far.  I'll have a go at that ServiceTracker in the next day or two

    David 

View as RSS news feed in XML