Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Exception in gef shapes example:java.lang.NoClassDefFoundError: Could not initialize class org.eclip
Exception in gef shapes example:java.lang.NoClassDefFoundError: Could not initialize class org.eclip [message #241405] Sun, 10 February 2008 11:40 Go to next message
Eclipse UserFriend
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
Re: Exception in gef shapes example:java.lang.NoClassDefFoundError: Could not initialize class org.e [message #241435 is a reply to message #241405] Mon, 11 February 2008 15:52 Go to previous messageGo to next message
Anthony Hunter is currently offline Anthony HunterFriend
Messages: 446
Registered: July 2009
Senior Member
Hi Armin

Why would the icons be missing in the examples? What are you testing?

Cheers...
Anthony

"Armin" <freelancer.armin@googlemail.com> wrote in message
news:fomnso$ef6$1@build.eclipse.org...
> 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
Re: Exception in gef shapes example:java.lang.NoClassDefFoundError: Could not initialize class org.e [message #241440 is a reply to message #241435] Tue, 12 February 2008 00:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: freelancer.armin.googlemail.com

Hi Anthony
i tried to compile the source code and run the gef shapes example. I
started with a blank plugin project to learn it from the base.
I added the icons in the build properties of the plugin. The icons
directory in the eclipse plugin development workspace contains the icon
files.
I dont know why eclipse do not find the icons in the plugin debug
workspace.
Cheers

Anthony Hunter schrieb:
> Hi Armin
>
> Why would the icons be missing in the examples? What are you testing?
>
> Cheers...
> Anthony
>
> "Armin" <freelancer.armin@googlemail.com> wrote in message
> news:fomnso$ef6$1@build.eclipse.org...
>> 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
>
>
Re: Exception in gef shapes example:java.lang.NoClassDefFoundError: Could not initialize class org.e [message #1841064 is a reply to message #241440] Sun, 02 May 2021 20:41 Go to previous message
ionel stefanuca is currently offline ionel stefanucaFriend
Messages: 4
Registered: April 2021
Junior Member
Hi, you can try to discuss with a freelancer from we are hiring

[Updated on: Tue, 04 May 2021 05:05]

Report message to a moderator

Previous Topic:GEF5 FX: Using Connection
Next Topic:Group/ungroup elements
Goto Forum:
  


Current Time: Fri Sep 24 18:52:30 GMT 2021

Powered by FUDForum. Page generated in 0.01836 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top