Using SVG-Export directly/NoClassDefFoundError [message #1248770] |
Mon, 17 February 2014 16:42 |
Felix R Messages: 2 Registered: February 2014 |
Junior Member |
|
|
I am running into Problems when trying to use org.eclipse.graphiti.export.batik.SVGExporter directly in my RCP app. My editors are not based on graphiti, but on gmf/emf instead, and I would like to only use the svg-export functionality provided by graphiti. (Is there a reason this should not work?)
What I have tried so far is adding the graphiti.export.batik plugin as a dependecy to my plugin. Then I had to configure the access rules for this plugin, because every access was forbidden by default('Forbidden: **/*'). After that, I was able to import the graphiti.export.batik package into my file, and I created an instance of SVGExporter and called "export" on it, with my desired parameters.
However, I get NoClassDefFoundErrors/ClassNotFoundExceptions when I run the code:
!ENTRY org.eclipse.ui 4 0 2014-02-17 17:38:21.509
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NoClassDefFoundError: org/eclipse/graphiti/export/batik/SVGExporter
at arcade.gui.components.widgets.AbstractGraphEditor$3.run(AbstractGraphEditor.java:227)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.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.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
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:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
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:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Caused by: java.lang.ClassNotFoundException: org.eclipse.graphiti.export.batik.SVGExporter
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(Unknown Source)
... 31 more
At this point I am kind of lost. I included the necessary plugins also in my feature and in my run configuration. Running the OSGi consoles's 'diag' on graphiti.export.batik also didn't report any errors. However this was the first time I used the OSGi console, so I didn't really know what to do, and only tried some commands.
I would be grateful for any help/advice/comments!
|
|
|
|
Re: Using SVG-Export directly/NoClassDefFoundError [message #1250702 is a reply to message #1250680] |
Wed, 19 February 2014 14:02 |
Felix R Messages: 2 Registered: February 2014 |
Junior Member |
|
|
Michael Wenz wrote on Wed, 19 February 2014 08:30Felix,
first a word of warning on this: the export.batik plugin is not intended to
provide any API, so this might change at any time. That's also why there's
no export package entries.
Not sure what exactly you did to get access to the packages, but is seems as
if this does not affect runtime. Have you tried to import the plugin in
source and add the export statements?
Michael
Hello Michael,
first of all thank you for your reply. I just solved the issue half an hour ago by copying the graphiti.export.batik plugin's source code (only about 5 files) from graphiti's git into my project. This way I get no runtime errors, and was able to adapt one or two lines from the export code to fit my needs. Thus, I also don't have any problems with changing APIs.
I found this to be a good solution, because the files in graphiti.export.batik are only very few, and have almost no dependencies to other graphiti files, so it is easy to adapt them to other code bases.
Felix
|
|
|
Powered by
FUDForum. Page generated in 0.02709 seconds