-1

Hi i am working on an eclipse RCP project and i need to run a function from a class from my ViewPart by adding the instance to a button Selected Listener, i am using Gate NLP in the function so after running the project i get a lot of exceptions this is a part of it :

org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: gate/util/GateException
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
    at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:877)
    at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:857)
    at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:119)
    at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:333)
    at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:254)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
    at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:129)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:949)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:633)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$6.run(PartRenderingEngine.java:526)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    ....
    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:354)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: java.lang.NoClassDefFoundError: gate/util/GateException
    at segmentation.View.createPartControl(View.java:258)
    at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:142)
    at org.eclipse.ui.internal.e4.compatibility.CompatibilityView.createPartControl(CompatibilityView.java:174)
    at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:323)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
    ... 84 more
Caused by: java.lang.ClassNotFoundException: gate.util.GateException cannot be found by Segmentation_1.0.0.qualifier
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 93 more

and this is how i used the class :

btnSegmenter.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            SegClass s = new SegClass();

            if ((!(text_2.getText().isEmpty())) && (!(text_1.getText().isEmpty())))
                    {
                    try {
                        s.Segmenter(text_3.getText(), text_2.getText());
                    } catch (GateException | IOException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }
                    }


        }
    });

So please help me to find another way to run my class thank you !

Nomesh DeSilva
  • 1,649
  • 4
  • 25
  • 43
Dreamer
  • 17
  • 7
  • take a look at http://javarevisited.blogspot.co.at/2011/06/noclassdeffounderror-exception-in.html – duffy356 May 15 '15 at 08:23
  • `NoClassDefFoundError` is _always_ about a class that was present in compile time, but missing in run time. – maksimov May 15 '15 at 08:25
  • what do you mean present in compile time, but missing in run time ? i actually testes the code on a simple java project it worked then i create an instance of the class and try to run it there after pushing the button can you please tell me where is the problem ? – Dreamer May 15 '15 at 08:29
  • Class loader is unable to find a JAR or a directory containing the class - in runtime. In other words, make sure `gate.util.GateException` is on classpath. – maksimov May 15 '15 at 08:45

1 Answers1

1

Did you add 'Segmentation' related jar or file to plugin run-time.
Plugin.xml ->Run-time->class path-> add->

Kondal Kolipaka
  • 3,471
  • 22
  • 28
  • Open your plugin.xml file Plugin.xml ->Run-time->class path-> add-> – Kondal Kolipaka May 15 '15 at 08:37
  • http://stackoverflow.com/questions/5744520/adding-jars-to-a-eclipse-plugin i found this it is really useful thank you for your help everyone – Dreamer May 15 '15 at 08:40
  • Use Import>File System to import the jar files into your plugin project, say in the /lib directory. Use "Add..." to add the jars to the classpath section of the plugin.xml>Runtime tab. Use "New..." to add "." library back (with no quotes, of course). make sure your binary build exports the new jar files on the plugin.xml>Build tab. save on the project, use context menu>PDE Tools>Update Classpath to correctly add the jars to the eclipse project classpath. i used this but i have a question do i have to add New..." to add "." library back for each jar ?? – Dreamer May 15 '15 at 10:36