0

am working with plugin creation for eclipse, in which, I need to convert JavaObjects into Json files, for which am using below specified jar files from Jackson, and its not getting any error during compilation but during runtime, below error is thrown. Also the json conversion is working fine if importing and running in a standalone java application but only annoys with error when using with View in plugin execution. Please anyone guide me on the same.

jackson-core-2.5.4.jar jackson-core-2.8.3.jar

Error thrown:

Exception:java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper
     at HIDDEN.HIDDEN(HIDDEN:-1)
     at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:220)
     at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
     at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
     at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
     at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)
     at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)
     at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
     at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
     at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
     at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
     at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:694)
     at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
     at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:606)
     at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
     at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
     at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
     at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
     at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
     at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
     at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:498)
     at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
     at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
     at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
     at org.eclipse.equinox.launcher.Main.main(Main.java:1488)
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.map.ObjectMapper cannot be found by com.temenos.testware_1.0.0
     at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:439)
     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352)
     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344)
     at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
     at HIDDEN.HIDDEN(HIDDEN:-1)
     at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:220)
     at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
     at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
     at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
     at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)
     at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)
     at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
     at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
     at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
     at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
     at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:694)
     at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
     at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:606)
     at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
     at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
     at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
     at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
     at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
     at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
     at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:498)
     at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
     at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
     at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
     at org.eclipse.equinox.launcher.Main.main(Main.java:1488)

Import statement that i used: import org.codehaus.jackson.map.ObjectMapper;

  • Have you included the jars in your plugin? You can't just reference external jars in a plugin. – greg-449 Sep 11 '17 at 13:39
  • You are using jackson2, please use the import classes from `com.fasterxml.jackson.databind`. If you are using `maven`, then include `jackson-databind` which will bring `jackson-core` and `jackson-annotations` transitively. – Rishikesh Darandale Sep 11 '17 at 13:45
  • Do you understand what 'java.lang.ClassNotFoundException' means and how to fix it? – Thorbjørn Ravn Andersen Sep 11 '17 at 14:25
  • 1. @ greg-449, I had added the jars to plugin, so I was getting that error, but now am trying to add the source files of the jar as one of the package to my plugin, so that reference can be made internally. But I couldnt get the source code without errors, I tried with different versions of jackson jar, but helpless, so If possible, anyone share me the source code for the jar "jackson-all-1.9.0.jar" 2. @Rishikesh Darandale, as said, am trying to add the source files of the jackson jar, so pls help me by sharing the source code for the jar "jackson-all-1.9.0.jar" – MaheshKathirvel Sep 12 '17 at 12:23
  • @MaheshKathirvel, I am not familiar with eclpse plugin development. But I am certain that you are facing the issue due to jackson 1 and jackson 2 collision. [Here](https://github.com/FasterXML/jackson-1) here is jackson 1 source code. – Rishikesh Darandale Sep 12 '17 at 12:42
  • @ Rishikesh Darandale, thanks for sharing the git path, I tried with the source code from the given path but after loading the source code to my project, most of the imports in java files, point to java files which belong to different versions of jackson, so it throws lot of errors due to dependency. for ex; in the AbstractDeserializer.java file, the import statment "import com.fasterxml.jackson.annotation.ObjectIdResolver;" shown as error due to the ObjectIdResolover file is missing, which belong to "jackson-annotations-2.5.0.jar" (found it when googled). – MaheshKathirvel Sep 12 '17 at 13:32
  • So my question now is, is there a source which contains both jackson1 & 2 source code? (Note: even I tried with latest version 2.8.3 also) – MaheshKathirvel Sep 12 '17 at 13:35
  • I got the solution, below post helped me out "https://stackoverflow.com/questions/5744520/adding-jars-to-a-eclipse-plugin" and I am able to use the ObjectMapper after following the steps given, and many credits and thanks to you all who tried to help me on the same. – MaheshKathirvel Sep 13 '17 at 05:04

0 Answers0