Na Meng, make sure you are exporting the Neo4j core packages from the bundle that provides org.graphdb ....
The easiest way to do this is to create a library plugin. That is, create a new plugin, put the Neo4j jars in the lib- folder, add them to the runtime classpath of the plugin in the MANIFEST.MF and export them in the runtime tab of the MANIFEST.MF. If you have any problems with this, let me know and I can try to guide you via Skype! /peter On Mon, Feb 7, 2011 at 7:08 PM, 娜 孟 <[email protected]> wrote: > > Hi all, > Currently, I'm developing an Eclipse plugin which calls API in neo4j. There > is no compiler error when writing the code.However, when I try to run the > plugin, the following errors always come up: > java.lang.ClassNotFoundException: org.neo4j.graphdb.Node 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:250) at > java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398) at > java.lang.Class.forName0(Native Method) at > java.lang.Class.forName(Class.java:169) at > neo4jplugin.actions.SampleAction.run(SampleAction.java:33) at > org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251) > at > org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:229) > at > org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) > at org.eclipse.jface.action.ActionContributi > onItem.access$2(ActionContributionItem.java:501) at > org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452) > at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) > at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3776) at > org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1367) at > org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1390) at > org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375) at > org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1187) at > org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3622) at > org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3277) at > org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629) at > org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593) at > org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427) at > org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670) at > org.eclipse.core.databinding.observable.Realm. > runWithDefault(Realm.java:332) at > org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663) > at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at > org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115) > 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(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:619) at > org.eclipse.equinox.launcher.Main.basicRun(Main.java:574) at > org.eclipse.equinox.launcher.Main.run(Main.java:1407) at > org.eclipse.equinox.launcher.Main.main(Main.java:1383) > I got this error when I simply wrote the following code SampleAction of an > Eclipse plugin: try { > Class.forName("org.neo4j.graphdb.Node"); } catch > (ClassNotFoundException e) { // TODO Auto-generated catch > block e.printStackTrace(); } > The errors do not exist when I invoke the APIs from a simple Java application > instead of Eclipse plugin. > Besides, for the Eclipse plugin, I have already add > neo4j-graph-matching-0.8-20100326.104823-10.jar to MANIFEST.MF file, like > this: > Manifest-Version: 1.0Bundle-ManifestVersion: 2Bundle-Name: > Neo4JPluginBundle-SymbolicName: Neo4JPlugin; singleton:=trueBundle-Version: > 1.0.0.qualifierBundle-Activator: neo4jplugin.ActivatorRequire-Bundle: > org.eclipse.ui, org.eclipse.core.runtimeBundle-ActivationPolicy: > lazyBundle-RequiredExecutionEnvironment: JavaSE-1.6Bundle-ClassPath: ., > neo4j-graph-matching-0.8-20100326.104823-10.jar > Please help me figure out what is wrong. > Thank you very much!Na Meng > > > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

