Exception in gef shapes example:java.lang.NoClassDefFoundError: Could not initialize class org.eclip [message #241405] |
Sun, 10 February 2008 06:40  |
Eclipse User |
|
|
|
Originally posted by: freelancer.armin.googlemail.com
Well,
I've found the problem in the createImage(String name) method of
org.eclipse.gef.examples.shapes.model.Shape class.
The new Image(null,stream) statement throws a null pointer exception, if
the image does not exists!
The workaround or fix is to encapsulate it with a try/catch.
protected static Image createImage(String name) {
Image image=null;
try{
InputStream stream = ShapesPlugin.class.getResourceAsStream(name);
image = new Image(null, stream);
try {
stream.close();
} catch (IOException ioe) {
}
}
catch(Exception e){
e.printStackTrace();
}
return image;
}
Hi,
Im getting the following exception, when I click the Ellipse and move
into the graph viewer each time when i move the mouse into the viewer:
Unhandled event loop exception
java.lang.NoClassDefFoundError: Could not initialize class
java.lang.NoClassDefFoundError: Could not initialize class
org.eclipse.gef.examples.shapes.model.EllipticalShape
at sun.reflect.GeneratedConstructorAccessor7.newInstance(Unknow n Source)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De legatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:5 13)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at
org.eclipse.gef.requests.SimpleFactory.getNewObject(SimpleFa ctory.java:39)
at
org.eclipse.gef.requests.CreateRequest.getNewObject(CreateRe quest.java:73)
at
org.eclipse.gef.examples.shapes.parts.DiagramEditPart$Shapes XYLayoutEditPolicy.getCreateCommand(DiagramEditPart.java:167 )
at
org.eclipse.gef.editpolicies.LayoutEditPolicy.getCommand(Lay outEditPolicy.java:199)
at
org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy.get Command(ConstrainedLayoutEditPolicy.java:154)
at
org.eclipse.gef.editparts.AbstractEditPart.getCommand(Abstra ctEditPart.java:473)
at org.eclipse.gef.tools.TargetingTool.getCommand(TargetingTool .java:122)
at org.eclipse.gef.tools.CreationTool.handleMove(CreationTool.j ava:239)
at org.eclipse.gef.tools.AbstractTool.mouseMove(AbstractTool.ja va:1038)
at org.eclipse.gef.EditDomain.mouseMove(EditDomain.java:248)
at
org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouse Moved(DomainEventDispatcher.java:359)
at
org.eclipse.draw2d.LightweightSystem$EventHandler.mouseMove( LightweightSystem.java:533)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:198)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
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(EclipseS tarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.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)
Im using
gef 3.2.101v20070814
eclipse 3.3.1 Build id: M20070921-1145
Any ideas?
Thx
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08341 seconds