Skip to main content



      Home
Home » Eclipse Projects » GEF » ClassNotFoundException in using EMF model in GEF
ClassNotFoundException in using EMF model in GEF [message #239705] Fri, 09 November 2007 09:47 Go to next message
Eclipse UserFriend
Originally posted by: heiyuchuanxia.163.com

hi, I'm a beginner with GEF, and recently I try to build the
"ShapeEditor" example using the generated EMF model, there is no problem
when draw figures and save the model, but it has
ClassNotFoundException when I try to open a saved file. and this
exception is thrown at the method Editor.setInput().

EllipseImpl is the EMF model implement class, there is no problem when I
construct an instance when add a child to the parent
model(ShapesDiagram), and there is also no problem when open the file
which only has a ShapesDiagram, no Ellipse(haven't draw yet).

the track detail:

java.lang.ClassNotFoundException:
edu.xidian.ictt.webservices.shapeEditor.model.impl.EllipseIm pl
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:407)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at java.io.ObjectInputStream.resolveClass(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.eclipse.emf.common.util.BasicEList.readObject(BasicEList .java:1108)
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 java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor. setInput(ShapesEditor.java:189)
at
edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor. init(ShapesEditor.java:86)
at org.eclipse.ui.internal.EditorManager.createSite(EditorManag er.java:839)
at
org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:583)
at
org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:372)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:566)
at
org.eclipse.ui.internal.EditorReference.getEditor(EditorRefe rence.java:214)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2588)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2521)
at org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPag e.java:2513)
at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:2498)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2493)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2478)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:388)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:350)
at
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:275)
at
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:139)
at
org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open(Open ActionUtil.java:49)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:19 0)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:17 4)
at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchR un(SelectionDispatchAction.java:267)
at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(Selec tionDispatchAction.java:243)
at
org.eclipse.jdt.internal.ui.packageview.PackageExplorerActio nGroup.handleOpen(PackageExplorerActionGroup.java:306)
at
org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$ 4.open(PackageExplorerPart.java:651)
at
org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredV iewer.java:817)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:843)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:14 9)
at
org.eclipse.jface.viewers.StructuredViewer.fireOpen(Structur edViewer.java:815)
at
org.eclipse.jface.viewers.StructuredViewer.handleOpen(Struct uredViewer.java:1069)
at
org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(Stru cturedViewer.java:1168)
at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrate gy.java:249)
at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.ja va:243)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrate gy.java:283)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
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.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)

I'm very appreciate to be contacted if you have some idea to solve
this problem, and very welcome to discuss similar problems.

Thanks
Stefanie
Re: ClassNotFoundException in using EMF model in GEF [message #239712 is a reply to message #239705] Fri, 09 November 2007 10:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------050609090009010901060307
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Stefanie,

Have you been messing with the project's properties to update the build
path directly rather than using the MANIFEST.MF's Dependency tab to
create proper plugin dependencies. It's a very common newbie trap
because it fixes the compile time errors but then the come back at
runtime. I also see you are using java.io.Serializeable and that
results in special problems in Eclipse so likely that's the cause of the
problem. You need to learn about buddy class loading to make it work.
You'll need an entry like this in your base plugin MANIFEST.MF if some
base plugin needs to load a class from some downstream plugin.

Eclipse-BuddyPolicy: dependent



stefanie zhao wrote:
>
> hi, I'm a beginner with GEF, and recently I try to build the
> "ShapeEditor" example using the generated EMF model, there is no
> problem when draw figures and save the model, but it has
> ClassNotFoundException when I try to open a saved file. and this
> exception is thrown at the method Editor.setInput().
>
> EllipseImpl is the EMF model implement class, there is no problem when
> I construct an instance when add a child to the parent
> model(ShapesDiagram), and there is also no problem when open the file
> which only has a ShapesDiagram, no Ellipse(haven't draw yet).
>
> the track detail:
>
> java.lang.ClassNotFoundException:
> edu.xidian.ictt.webservices.shapeEditor.model.impl.EllipseIm pl
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:407)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Unknown Source)
> at java.io.ObjectInputStream.resolveClass(Unknown Source)
> at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
> at java.io.ObjectInputStream.readClassDesc(Unknown Source)
> at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
> at java.io.ObjectInputStream.readObject0(Unknown Source)
> at java.io.ObjectInputStream.readObject(Unknown Source)
> at
> org.eclipse.emf.common.util.BasicEList.readObject(BasicEList .java:1108)
> 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 java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
> at java.io.ObjectInputStream.readSerialData(Unknown Source)
> at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
> at java.io.ObjectInputStream.readObject0(Unknown Source)
> at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
> at java.io.ObjectInputStream.readSerialData(Unknown Source)
> at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
> at java.io.ObjectInputStream.readObject0(Unknown Source)
> at java.io.ObjectInputStream.readObject(Unknown Source)
> at
> edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor. setInput(ShapesEditor.java:189)
>
> at
> edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor. init(ShapesEditor.java:86)
>
> at
> org.eclipse.ui.internal.EditorManager.createSite(EditorManag er.java:839)
> at
> org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:583)
>
> at
> org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:372)
>
> at
> org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:566)
>
> at
> org.eclipse.ui.internal.EditorReference.getEditor(EditorRefe rence.java:214)
>
> at
> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2588)
>
> at
> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2521)
>
> at
> org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPag e.java:2513)
> at
> org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:2498)
> at
> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
> at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2493)
> at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2478)
> at org.eclipse.ui.ide.IDE.openEditor(IDE.java:388)
> at org.eclipse.ui.ide.IDE.openEditor(IDE.java:350)
> at
> org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:275)
>
> at
> org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:139)
>
> at
> org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open(Open ActionUtil.java:49)
>
> at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:19 0)
> at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:17 4)
> at
> org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchR un(SelectionDispatchAction.java:267)
>
> at
> org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(Selec tionDispatchAction.java:243)
>
> at
> org.eclipse.jdt.internal.ui.packageview.PackageExplorerActio nGroup.handleOpen(PackageExplorerActionGroup.java:306)
>
> at
> org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$ 4.open(PackageExplorerPart.java:651)
>
> at
> org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredV iewer.java:817)
>
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
> at org.eclipse.core.runtime.Platform.run(Platform.java:843)
> at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
> at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:14 9)
> at
> org.eclipse.jface.viewers.StructuredViewer.fireOpen(Structur edViewer.java:815)
>
> at
> org.eclipse.jface.viewers.StructuredViewer.handleOpen(Struct uredViewer.java:1069)
>
> at
> org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(Stru cturedViewer.java:1168)
>
> at
> org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrate gy.java:249)
> at
> org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.ja va:243)
> at
> org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrate gy.java:283)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
> at
> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)
> at
> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
>
> at
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>
> 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.core.launcher.Main.invokeFramework(Main.java:336 )
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
>
> I'm very appreciate to be contacted if you have some idea to solve
> this problem, and very welcome to discuss similar problems.
>
> Thanks
> Stefanie


--------------050609090009010901060307
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Stefanie,<br>
<br>
Have you been messing with the project's properties to update the build
path directly rather than using the MANIFEST.MF's Dependency tab to
create proper plugin dependencies.  It's a very common newbie trap
because it fixes the compile time errors but then the come back at
runtime.  I also see you are using java.io.Serializeable and that
results in special problems in Eclipse so likely that's the cause of
the problem.  You need to learn about buddy class loading to make it
work.  You'll need an entry like this in your base plugin MANIFEST.MF
if some base plugin needs to load a class from some downstream plugin.<br>
<br>
<blockquote>Eclipse-BuddyPolicy: dependent<br>
</blockquote>
<br>
<br>
stefanie zhao wrote:
<blockquote cite="mid:473472EE.9090204@163.com" type="cite"><br>
hi, I'm a beginner with GEF, and recently I try to build the
"ShapeEditor" example using the generated EMF model, there is no
problem   when draw figures and save the model, but it has
ClassNotFoundException when I try to open a saved file. and this
exception is thrown at the method Editor.setInput().
<br>
<br>
EllipseImpl is the EMF model implement class, there is no problem when
I construct an instance when add a child to the parent
model(ShapesDiagram), and there is also no problem when open the file
which only has a ShapesDiagram, no Ellipse(haven't draw yet).
<br>
<br>
the track detail:
<br>
<br>
java.lang.ClassNotFoundException:
edu.xidian.ictt.webservices.shapeEditor.model.impl.EllipseIm pl
<br>
    at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:407)
<br>
    at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)
<br>
    at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
<br>
    at java.lang.ClassLoader.loadClass(Unknown Source)
<br>
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
<br>
    at java.lang.Class.forName0(Native Method)
<br>
    at java.lang.Class.forName(Unknown Source)
<br>
    at java.io.ObjectInputStream.resolveClass(Unknown Source)
<br>
    at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
<br>
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
<br>
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
<br>
    at java.io.ObjectInputStream.readObject0(Unknown Source)
<br>
    at java.io.ObjectInputStream.readObject(Unknown Source)
<br>
    at
org.eclipse.emf.common.util.BasicEList.readObject(BasicEList .java:1108)
<br>
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
<br>
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
<br>
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
<br>
    at java.lang.reflect.Method.invoke(Unknown Source)
<br>
    at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
<br>
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
<br>
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
<br>
    at java.io.ObjectInputStream.readObject0(Unknown Source)
<br>
    at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
<br>
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
<br>
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
<br>
    at java.io.ObjectInputStream.readObject0(Unknown Source)
<br>
    at java.io.ObjectInputStream.readObject(Unknown Source)
<br>
    at
edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor. setInput(ShapesEditor.java:189)
<br>
    at
edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor. init(ShapesEditor.java:86)
<br>
    at
org.eclipse.ui.internal.EditorManager.createSite(EditorManag er.java:839)
<br>
    at
org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:583)
<br>
    at
org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:372)
<br>
    at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:566)
<br>
    at
org.eclipse.ui.internal.EditorReference.getEditor(EditorRefe rence.java:214)
<br>
    at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2588)
<br>
    at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2521)
<br>
    at
org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPag e.java:2513)
<br>
    at
org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:2498)
<br>
    at
org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
<br>
    at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2493)
<br>
    at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2478)
<br>
    at org.eclipse.ui.ide.IDE.openEditor(IDE.java:388)
<br>
    at org.eclipse.ui.ide.IDE.openEditor(IDE.java:350)
<br>
    at
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:275)
<br>
    at
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:139)
<br>
    at
org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open(Open ActionUtil.java:49)
<br>
    at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:19 0)
<br>
    at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:17 4)
<br>
    at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchR un(SelectionDispatchAction.java:267)
<br>
    at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(Selec tionDispatchAction.java:243)
<br>
    at
org.eclipse.jdt.internal.ui.packageview.PackageExplorerActio nGroup.handleOpen(PackageExplorerActionGroup.java:306)
<br>
    at
org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$ 4.open(PackageExplorerPart.java:651)
<br>
    at
org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredV iewer.java:817)
<br>
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
<br>
    at org.eclipse.core.runtime.Platform.run(Platform.java:843)
<br>
    at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
<br>
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:14 9)
<br>
    at
org.eclipse.jface.viewers.StructuredViewer.fireOpen(Structur edViewer.java:815)
<br>
    at
org.eclipse.jface.viewers.StructuredViewer.handleOpen(Struct uredViewer.java:1069)
<br>
    at
org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(Stru cturedViewer.java:1168)
<br>
    at
org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrate gy.java:249)
<br>
    at
org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.ja va:243)
<br>
    at
org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrate gy.java:283)
<br>
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
<br>
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
<br>
    at
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)
<br>
    at
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)
<br>
    at
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
<br>
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
<br>
    at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
<br>
    at
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
<br>
    at
org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
<br>
    at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
<br>
    at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
<br>
    at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
<br>
    at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
<br>
    at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
<br>
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
<br>
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
<br>
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
<br>
    at java.lang.reflect.Method.invoke(Unknown Source)
<br>
    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
<br>
    at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
<br>
    at org.eclipse.core.launcher.Main.run(Main.java:977)
<br>
    at org.eclipse.core.launcher.Main.main(Main.java:952)
<br>
<br>
 I'm very appreciate to be contacted if you have some idea to solve
this  problem, and very welcome to discuss similar problems.
<br>
<br>
Thanks
<br>
Stefanie
<br>
</blockquote>
<br>
</body>
</html>

--------------050609090009010901060307--
Re: ClassNotFoundException in using EMF model in GEF [message #239717 is a reply to message #239712] Sat, 10 November 2007 06:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: heiyuchuanxia.163.com

Ed Merks,

I'm very thankful for your reply, I tried your advice, adding an entry
"Eclipse-BuddyPolicy: dependent" in my MANIFEST.MF file, but the problem
is still there.

My project is a independent project, I build my EMF model in the same
project with GEF code. I think the appoarch you told me is used to load
class which are not in the same project, and thank you again for your
reply, I really learn some "buddy loader" thing.

I'm just curious that when I instance the model when adding some child
to the parent, there is no error, and the error only exist when I read
model from the file, so I suspect if the readObject method has something
wrong. And I will check it again. And I also suspect maybe some method
missing when I read the model using EMF code building an GEF project.

Thanks again, and very welcome to discuss similar problems.

Stefanie

My readObject method in the basic model:

private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
in.defaultReadObject();
pcsDelegate = new PropertyChangeSupport(this);
}

My MANIFEST.MF:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ShapeEditor
Bundle-SymbolicName: edu.xidian.ictt.webservices.shapeEditor;
singleton:=true
Bundle-Version: 1.0.0
Bundle-ClassPath: .
Bundle-Vendor: edu.xidian.ictt.webservices
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.ui,
org.eclipse.ui.views,
org.eclipse.gef,
org.eclipse.core.resources,
org.eclipse.ui.ide,
org.eclipse.emf.ecore.xmi
Eclipse-LazyStart: true
Eclipse-BuddyPolicy: dependent
Bundle-Activator: edu.xidian.ictt.webservices.shapeEditor.ShapeEditorPlugin

plugin.xml:

<plugin>

<extension
point="org.eclipse.ui.editors">
<editor

class="edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor "

contributorClass=" edu.xidian.ictt.webservices.shapeEditor.ShapesEditorActionBa rContributor "
default="true"
extensions="shape"
icon="icons/package_obj.gif"
id="edu.xidian.ictt.webservices.shapeEditor"
name="GEF Shape Editor"/>
</extension>
<extension
point="org.eclipse.ui.newWizards">
<category
id="org.eclipse.gef.shapes"
name="ShapeExamples"
parentCategory="org.eclipse.ui.Examples"/>
<wizard
category="org.eclipse.ui.Examples/org.eclipse.gef.shapes"

class=" edu.xidian.ictt.webservices.shapeEditor.ShapesCreationWizard "
icon="icons/package_obj.gif"
id="edu.xidian.ictt.webservices.shapeEditor.wizard"
name="ShapeWizard">
<selection class="org.eclipse.core.resources.IResource"/>
</wizard>
</extension>

</plugin>


Ed Merks 写道:
> Stefanie,
>
> Have you been messing with the project's properties to update the build
> path directly rather than using the MANIFEST.MF's Dependency tab to
> create proper plugin dependencies. It's a very common newbie trap
> because it fixes the compile time errors but then the come back at
> runtime. I also see you are using java.io.Serializeable and that
> results in special problems in Eclipse so likely that's the cause of the
> problem. You need to learn about buddy class loading to make it work.
> You'll need an entry like this in your base plugin MANIFEST.MF if some
> base plugin needs to load a class from some downstream plugin.
>
> Eclipse-BuddyPolicy: dependent
>
>
>
> stefanie zhao wrote:
>>
>> hi, I'm a beginner with GEF, and recently I try to build the
>> "ShapeEditor" example using the generated EMF model, there is no
>> problem when draw figures and save the model, but it has
>> ClassNotFoundException when I try to open a saved file. and this
>> exception is thrown at the method Editor.setInput().
>>
>> EllipseImpl is the EMF model implement class, there is no problem when
>> I construct an instance when add a child to the parent
>> model(ShapesDiagram), and there is also no problem when open the file
>> which only has a ShapesDiagram, no Ellipse(haven't draw yet).
>>
>> the track detail:
>>
>> java.lang.ClassNotFoundException:
>> edu.xidian.ictt.webservices.shapeEditor.model.impl.EllipseIm pl
>> at
>> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:407)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)
>>
>> at
>> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
>>
>> at java.lang.ClassLoader.loadClass(Unknown Source)
>> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>> at java.lang.Class.forName0(Native Method)
>> at java.lang.Class.forName(Unknown Source)
>> at java.io.ObjectInputStream.resolveClass(Unknown Source)
>> at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
>> at java.io.ObjectInputStream.readClassDesc(Unknown Source)
>> at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
>> at java.io.ObjectInputStream.readObject0(Unknown Source)
>> at java.io.ObjectInputStream.readObject(Unknown Source)
>> at
>> org.eclipse.emf.common.util.BasicEList.readObject(BasicEList .java:1108)
>> 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 java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
>> at java.io.ObjectInputStream.readSerialData(Unknown Source)
>> at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
>> at java.io.ObjectInputStream.readObject0(Unknown Source)
>> at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
>> at java.io.ObjectInputStream.readSerialData(Unknown Source)
>> at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
>> at java.io.ObjectInputStream.readObject0(Unknown Source)
>> at java.io.ObjectInputStream.readObject(Unknown Source)
>> at
>> edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor. setInput(ShapesEditor.java:189)
>>
>> at
>> edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor. init(ShapesEditor.java:86)
>>
>> at
>> org.eclipse.ui.internal.EditorManager.createSite(EditorManag er.java:839)
>> at
>> org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:583)
>>
>> at
>> org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:372)
>>
>> at
>> org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:566)
>>
>> at
>> org.eclipse.ui.internal.EditorReference.getEditor(EditorRefe rence.java:214)
>>
>> at
>> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2588)
>>
>> at
>> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2521)
>>
>> at
>> org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPag e.java:2513)
>> at
>> org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:2498)
>> at
>> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
>> at
>> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2493)
>> at
>> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2478)
>> at org.eclipse.ui.ide.IDE.openEditor(IDE.java:388)
>> at org.eclipse.ui.ide.IDE.openEditor(IDE.java:350)
>> at
>> org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:275)
>>
>> at
>> org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:139)
>>
>> at
>> org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open(Open ActionUtil.java:49)
>>
>> at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:19 0)
>> at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:17 4)
>> at
>> org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchR un(SelectionDispatchAction.java:267)
>>
>> at
>> org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(Selec tionDispatchAction.java:243)
>>
>> at
>> org.eclipse.jdt.internal.ui.packageview.PackageExplorerActio nGroup.handleOpen(PackageExplorerActionGroup.java:306)
>>
>> at
>> org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$ 4.open(PackageExplorerPart.java:651)
>>
>> at
>> org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredV iewer.java:817)
>>
>> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
>> at org.eclipse.core.runtime.Platform.run(Platform.java:843)
>> at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
>> at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:14 9)
>> at
>> org.eclipse.jface.viewers.StructuredViewer.fireOpen(Structur edViewer.java:815)
>>
>> at
>> org.eclipse.jface.viewers.StructuredViewer.handleOpen(Struct uredViewer.java:1069)
>>
>> at
>> org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(Stru cturedViewer.java:1168)
>>
>> at
>> org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrate gy.java:249)
>> at
>> org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.ja va:243)
>> at
>> org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrate gy.java:283)
>> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
>> at
>> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)
>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)
>> at
>> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
>> at
>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
>>
>> at
>> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>> at
>> org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
>> at
>> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>>
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>>
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>>
>> 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.core.launcher.Main.invokeFramework(Main.java:336 )
>> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
>> at org.eclipse.core.launcher.Main.run(Main.java:977)
>> at org.eclipse.core.launcher.Main.main(Main.java:952)
>>
>> I'm very appreciate to be contacted if you have some idea to solve
>> this problem, and very welcome to discuss similar problems.
>>
>> Thanks
>> Stefanie
>
Re: ClassNotFoundException in using EMF model in GEF [message #239722 is a reply to message #239717] Sat, 10 November 2007 08:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Stefanie,

I know that EMF models don't generally support java.io.Serializeable so
I'm not sure exactly what's being serialized. Using
java.io.Serializeable for long term persistence is not generally a good
idea. EMF models can be serialized as XML, and that's usually a much
better approach. So probably you'd be better to learn how to use EMF's
Resource APIs for persistence than trying to solve the problem you are
having...


stefanie zhao wrote:
> Ed Merks,
>
> I'm very thankful for your reply, I tried your advice, adding an entry
> "Eclipse-BuddyPolicy: dependent" in my MANIFEST.MF file, but the
> problem is still there.
>
> My project is a independent project, I build my EMF model in the same
> project with GEF code. I think the appoarch you told me is used to
> load class which are not in the same project, and thank you again for
> your reply, I really learn some "buddy loader" thing.
>
> I'm just curious that when I instance the model when adding some child
> to the parent, there is no error, and the error only exist when I read
> model from the file, so I suspect if the readObject method has
> something wrong. And I will check it again. And I also suspect maybe
> some method missing when I read the model using EMF code building an
> GEF project.
>
> Thanks again, and very welcome to discuss similar problems.
>
> Stefanie
>
> My readObject method in the basic model:
>
> private void readObject(ObjectInputStream in)
> throws IOException, ClassNotFoundException {
> in.defaultReadObject();
> pcsDelegate = new PropertyChangeSupport(this);
> }
>
> My MANIFEST.MF:
>
> Manifest-Version: 1.0
> Bundle-ManifestVersion: 2
> Bundle-Name: ShapeEditor
> Bundle-SymbolicName: edu.xidian.ictt.webservices.shapeEditor;
> singleton:=true
> Bundle-Version: 1.0.0
> Bundle-ClassPath: .
> Bundle-Vendor: edu.xidian.ictt.webservices
> Bundle-Localization: plugin
> Require-Bundle: org.eclipse.core.runtime,
> org.eclipse.emf.ecore;visibility:=reexport,
> org.eclipse.ui,
> org.eclipse.ui.views,
> org.eclipse.gef,
> org.eclipse.core.resources,
> org.eclipse.ui.ide,
> org.eclipse.emf.ecore.xmi
> Eclipse-LazyStart: true
> Eclipse-BuddyPolicy: dependent
> Bundle-Activator:
> edu.xidian.ictt.webservices.shapeEditor.ShapeEditorPlugin
>
> plugin.xml:
>
> <plugin>
>
> <extension
> point="org.eclipse.ui.editors">
> <editor
>
> class="edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor "
>
> contributorClass=" edu.xidian.ictt.webservices.shapeEditor.ShapesEditorActionBa rContributor "
>
> default="true"
> extensions="shape"
> icon="icons/package_obj.gif"
> id="edu.xidian.ictt.webservices.shapeEditor"
> name="GEF Shape Editor"/>
> </extension>
> <extension
> point="org.eclipse.ui.newWizards">
> <category
> id="org.eclipse.gef.shapes"
> name="ShapeExamples"
> parentCategory="org.eclipse.ui.Examples"/>
> <wizard
> category="org.eclipse.ui.Examples/org.eclipse.gef.shapes"
>
> class=" edu.xidian.ictt.webservices.shapeEditor.ShapesCreationWizard "
> icon="icons/package_obj.gif"
> id="edu.xidian.ictt.webservices.shapeEditor.wizard"
> name="ShapeWizard">
> <selection class="org.eclipse.core.resources.IResource"/>
> </wizard>
> </extension>
>
> </plugin>
>
>
> Ed Merks 写道:
>> Stefanie,
>>
>> Have you been messing with the project's properties to update the
>> build path directly rather than using the MANIFEST.MF's Dependency
>> tab to create proper plugin dependencies. It's a very common newbie
>> trap because it fixes the compile time errors but then the come back
>> at runtime. I also see you are using java.io.Serializeable and that
>> results in special problems in Eclipse so likely that's the cause of
>> the problem. You need to learn about buddy class loading to make it
>> work. You'll need an entry like this in your base plugin MANIFEST.MF
>> if some base plugin needs to load a class from some downstream plugin.
>>
>> Eclipse-BuddyPolicy: dependent
>>
>>
>>
>> stefanie zhao wrote:
>>>
>>> hi, I'm a beginner with GEF, and recently I try to build the
>>> "ShapeEditor" example using the generated EMF model, there is no
>>> problem when draw figures and save the model, but it has
>>> ClassNotFoundException when I try to open a saved file. and this
>>> exception is thrown at the method Editor.setInput().
>>>
>>> EllipseImpl is the EMF model implement class, there is no problem
>>> when I construct an instance when add a child to the parent
>>> model(ShapesDiagram), and there is also no problem when open the
>>> file which only has a ShapesDiagram, no Ellipse(haven't draw yet).
>>>
>>> the track detail:
>>>
>>> java.lang.ClassNotFoundException:
>>> edu.xidian.ictt.webservices.shapeEditor.model.impl.EllipseIm pl
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:407)
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)
>>>
>>> at
>>> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
>>>
>>> at java.lang.ClassLoader.loadClass(Unknown Source)
>>> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>>> at java.lang.Class.forName0(Native Method)
>>> at java.lang.Class.forName(Unknown Source)
>>> at java.io.ObjectInputStream.resolveClass(Unknown Source)
>>> at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
>>> at java.io.ObjectInputStream.readClassDesc(Unknown Source)
>>> at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
>>> at java.io.ObjectInputStream.readObject0(Unknown Source)
>>> at java.io.ObjectInputStream.readObject(Unknown Source)
>>> at
>>> org.eclipse.emf.common.util.BasicEList.readObject(BasicEList .java:1108)
>>> 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 java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
>>> at java.io.ObjectInputStream.readSerialData(Unknown Source)
>>> at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
>>> at java.io.ObjectInputStream.readObject0(Unknown Source)
>>> at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
>>> at java.io.ObjectInputStream.readSerialData(Unknown Source)
>>> at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
>>> at java.io.ObjectInputStream.readObject0(Unknown Source)
>>> at java.io.ObjectInputStream.readObject(Unknown Source)
>>> at
>>> edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor. setInput(ShapesEditor.java:189)
>>>
>>> at
>>> edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor. init(ShapesEditor.java:86)
>>>
>>> at
>>> org.eclipse.ui.internal.EditorManager.createSite(EditorManag er.java:839)
>>>
>>> at
>>> org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:583)
>>>
>>> at
>>> org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:372)
>>>
>>> at
>>> org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:566)
>>>
>>> at
>>> org.eclipse.ui.internal.EditorReference.getEditor(EditorRefe rence.java:214)
>>>
>>> at
>>> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2588)
>>>
>>> at
>>> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2521)
>>>
>>> at
>>> org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPag e.java:2513)
>>>
>>> at
>>> org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:2498)
>>> at
>>> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
>>> at
>>> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2493)
>>>
>>> at
>>> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2478)
>>>
>>> at org.eclipse.ui.ide.IDE.openEditor(IDE.java:388)
>>> at org.eclipse.ui.ide.IDE.openEditor(IDE.java:350)
>>> at
>>> org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:275)
>>>
>>> at
>>> org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:139)
>>>
>>> at
>>> org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open(Open ActionUtil.java:49)
>>>
>>> at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:19 0)
>>> at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:17 4)
>>> at
>>> org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchR un(SelectionDispatchAction.java:267)
>>>
>>> at
>>> org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(Selec tionDispatchAction.java:243)
>>>
>>> at
>>> org.eclipse.jdt.internal.ui.packageview.PackageExplorerActio nGroup.handleOpen(PackageExplorerActionGroup.java:306)
>>>
>>> at
>>> org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$ 4.open(PackageExplorerPart.java:651)
>>>
>>> at
>>> org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredV iewer.java:817)
>>>
>>> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
>>> at org.eclipse.core.runtime.Platform.run(Platform.java:843)
>>> at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
>>> at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:14 9)
>>> at
>>> org.eclipse.jface.viewers.StructuredViewer.fireOpen(Structur edViewer.java:815)
>>>
>>> at
>>> org.eclipse.jface.viewers.StructuredViewer.handleOpen(Struct uredViewer.java:1069)
>>>
>>> at
>>> org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(Stru cturedViewer.java:1168)
>>>
>>> at
>>> org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrate gy.java:249)
>>>
>>> at
>>> org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.ja va:243)
>>> at
>>> org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrate gy.java:283)
>>>
>>> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
>>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
>>> at
>>> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)
>>> at
>>> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)
>>> at
>>> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
>>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
>>> at
>>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
>>>
>>> at
>>> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>>> at
>>> org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
>>> at
>>> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>>>
>>> at
>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>>>
>>> at
>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>>>
>>> at
>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>>>
>>> at
>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>>>
>>> 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.core.launcher.Main.invokeFramework(Main.java:336 )
>>> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
>>> at org.eclipse.core.launcher.Main.run(Main.java:977)
>>> at org.eclipse.core.launcher.Main.main(Main.java:952)
>>>
>>> I'm very appreciate to be contacted if you have some idea to solve
>>> this problem, and very welcome to discuss similar problems.
>>>
>>> Thanks
>>> Stefanie
>>
Re: ClassNotFoundException in using EMF model in GEF [message #239732 is a reply to message #239722] Sun, 11 November 2007 03:58 Go to previous message
Eclipse UserFriend
Originally posted by: heiyuchuanxia.163.com

Ed Merks,
Thank you very much for this good idea to solve my problem, and now
I use the Resource API to persistence my EMF model, and the loading and
saving are all good.
Thank again, and I really learn a lot from your every reply. I'm
just a newbie here, hoping discuss more interesting problems with you
during my learning, that absolutly is a pleasure.

Stefanie

Ed Merks 写道:
> Stefanie,
>
> I know that EMF models don't generally support java.io.Serializeable so
> I'm not sure exactly what's being serialized. Using
> java.io.Serializeable for long term persistence is not generally a good
> idea. EMF models can be serialized as XML, and that's usually a much
> better approach. So probably you'd be better to learn how to use EMF's
> Resource APIs for persistence than trying to solve the problem you are
> having...
>
>
> stefanie zhao wrote:
>> Ed Merks,
>>
>> I'm very thankful for your reply, I tried your advice, adding an entry
>> "Eclipse-BuddyPolicy: dependent" in my MANIFEST.MF file, but the
>> problem is still there.
>>
>> My project is a independent project, I build my EMF model in the same
>> project with GEF code. I think the appoarch you told me is used to
>> load class which are not in the same project, and thank you again for
>> your reply, I really learn some "buddy loader" thing.
>>
>> I'm just curious that when I instance the model when adding some child
>> to the parent, there is no error, and the error only exist when I read
>> model from the file, so I suspect if the readObject method has
>> something wrong. And I will check it again. And I also suspect maybe
>> some method missing when I read the model using EMF code building an
>> GEF project.
>>
>> Thanks again, and very welcome to discuss similar problems.
>>
>> Stefanie
>>
>> My readObject method in the basic model:
>>
>> private void readObject(ObjectInputStream in)
>> throws IOException, ClassNotFoundException {
>> in.defaultReadObject();
>> pcsDelegate = new PropertyChangeSupport(this);
>> }
>>
>> My MANIFEST.MF:
>>
>> Manifest-Version: 1.0
>> Bundle-ManifestVersion: 2
>> Bundle-Name: ShapeEditor
>> Bundle-SymbolicName: edu.xidian.ictt.webservices.shapeEditor;
>> singleton:=true
>> Bundle-Version: 1.0.0
>> Bundle-ClassPath: .
>> Bundle-Vendor: edu.xidian.ictt.webservices
>> Bundle-Localization: plugin
>> Require-Bundle: org.eclipse.core.runtime,
>> org.eclipse.emf.ecore;visibility:=reexport,
>> org.eclipse.ui,
>> org.eclipse.ui.views,
>> org.eclipse.gef,
>> org.eclipse.core.resources,
>> org.eclipse.ui.ide,
>> org.eclipse.emf.ecore.xmi
>> Eclipse-LazyStart: true
>> Eclipse-BuddyPolicy: dependent
>> Bundle-Activator:
>> edu.xidian.ictt.webservices.shapeEditor.ShapeEditorPlugin
>>
>> plugin.xml:
>>
>> <plugin>
>>
>> <extension
>> point="org.eclipse.ui.editors">
>> <editor
>>
>> class="edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor "
>>
>> contributorClass=" edu.xidian.ictt.webservices.shapeEditor.ShapesEditorActionBa rContributor "
>>
>> default="true"
>> extensions="shape"
>> icon="icons/package_obj.gif"
>> id="edu.xidian.ictt.webservices.shapeEditor"
>> name="GEF Shape Editor"/>
>> </extension>
>> <extension
>> point="org.eclipse.ui.newWizards">
>> <category
>> id="org.eclipse.gef.shapes"
>> name="ShapeExamples"
>> parentCategory="org.eclipse.ui.Examples"/>
>> <wizard
>> category="org.eclipse.ui.Examples/org.eclipse.gef.shapes"
>>
>> class=" edu.xidian.ictt.webservices.shapeEditor.ShapesCreationWizard "
>> icon="icons/package_obj.gif"
>> id="edu.xidian.ictt.webservices.shapeEditor.wizard"
>> name="ShapeWizard">
>> <selection class="org.eclipse.core.resources.IResource"/>
>> </wizard>
>> </extension>
>>
>> </plugin>
>>
>>
>> Ed Merks 写道:
>>> Stefanie,
>>>
>>> Have you been messing with the project's properties to update the
>>> build path directly rather than using the MANIFEST.MF's Dependency
>>> tab to create proper plugin dependencies. It's a very common newbie
>>> trap because it fixes the compile time errors but then the come back
>>> at runtime. I also see you are using java.io.Serializeable and that
>>> results in special problems in Eclipse so likely that's the cause of
>>> the problem. You need to learn about buddy class loading to make it
>>> work. You'll need an entry like this in your base plugin MANIFEST.MF
>>> if some base plugin needs to load a class from some downstream plugin.
>>>
>>> Eclipse-BuddyPolicy: dependent
>>>
>>>
>>>
>>> stefanie zhao wrote:
>>>>
>>>> hi, I'm a beginner with GEF, and recently I try to build the
>>>> "ShapeEditor" example using the generated EMF model, there is no
>>>> problem when draw figures and save the model, but it has
>>>> ClassNotFoundException when I try to open a saved file. and this
>>>> exception is thrown at the method Editor.setInput().
>>>>
>>>> EllipseImpl is the EMF model implement class, there is no problem
>>>> when I construct an instance when add a child to the parent
>>>> model(ShapesDiagram), and there is also no problem when open the
>>>> file which only has a ShapesDiagram, no Ellipse(haven't draw yet).
>>>>
>>>> the track detail:
>>>>
>>>> java.lang.ClassNotFoundException:
>>>> edu.xidian.ictt.webservices.shapeEditor.model.impl.EllipseIm pl
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:407)
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)
>>>>
>>>> at
>>>> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
>>>>
>>>> at java.lang.ClassLoader.loadClass(Unknown Source)
>>>> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>>>> at java.lang.Class.forName0(Native Method)
>>>> at java.lang.Class.forName(Unknown Source)
>>>> at java.io.ObjectInputStream.resolveClass(Unknown Source)
>>>> at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
>>>> at java.io.ObjectInputStream.readClassDesc(Unknown Source)
>>>> at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
>>>> at java.io.ObjectInputStream.readObject0(Unknown Source)
>>>> at java.io.ObjectInputStream.readObject(Unknown Source)
>>>> at
>>>> org.eclipse.emf.common.util.BasicEList.readObject(BasicEList .java:1108)
>>>> 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 java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
>>>> at java.io.ObjectInputStream.readSerialData(Unknown Source)
>>>> at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
>>>> at java.io.ObjectInputStream.readObject0(Unknown Source)
>>>> at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
>>>> at java.io.ObjectInputStream.readSerialData(Unknown Source)
>>>> at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
>>>> at java.io.ObjectInputStream.readObject0(Unknown Source)
>>>> at java.io.ObjectInputStream.readObject(Unknown Source)
>>>> at
>>>> edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor. setInput(ShapesEditor.java:189)
>>>>
>>>> at
>>>> edu.xidian.ictt.webservices.shapeEditor.editor.ShapesEditor. init(ShapesEditor.java:86)
>>>>
>>>> at
>>>> org.eclipse.ui.internal.EditorManager.createSite(EditorManag er.java:839)
>>>>
>>>> at
>>>> org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:583)
>>>>
>>>> at
>>>> org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:372)
>>>>
>>>> at
>>>> org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:566)
>>>>
>>>> at
>>>> org.eclipse.ui.internal.EditorReference.getEditor(EditorRefe rence.java:214)
>>>>
>>>> at
>>>> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2588)
>>>>
>>>> at
>>>> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2521)
>>>>
>>>> at
>>>> org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPag e.java:2513)
>>>>
>>>> at
>>>> org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:2498)
>>>> at
>>>> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
>>>> at
>>>> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2493)
>>>>
>>>> at
>>>> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2478)
>>>>
>>>> at org.eclipse.ui.ide.IDE.openEditor(IDE.java:388)
>>>> at org.eclipse.ui.ide.IDE.openEditor(IDE.java:350)
>>>> at
>>>> org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:275)
>>>>
>>>> at
>>>> org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:139)
>>>>
>>>> at
>>>> org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open(Open ActionUtil.java:49)
>>>>
>>>> at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:19 0)
>>>> at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:17 4)
>>>> at
>>>> org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchR un(SelectionDispatchAction.java:267)
>>>>
>>>> at
>>>> org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(Selec tionDispatchAction.java:243)
>>>>
>>>> at
>>>> org.eclipse.jdt.internal.ui.packageview.PackageExplorerActio nGroup.handleOpen(PackageExplorerActionGroup.java:306)
>>>>
>>>> at
>>>> org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$ 4.open(PackageExplorerPart.java:651)
>>>>
>>>> at
>>>> org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredV iewer.java:817)
>>>>
>>>> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
>>>> at org.eclipse.core.runtime.Platform.run(Platform.java:843)
>>>> at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
>>>> at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:14 9)
>>>> at
>>>> org.eclipse.jface.viewers.StructuredViewer.fireOpen(Structur edViewer.java:815)
>>>>
>>>> at
>>>> org.eclipse.jface.viewers.StructuredViewer.handleOpen(Struct uredViewer.java:1069)
>>>>
>>>> at
>>>> org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(Stru cturedViewer.java:1168)
>>>>
>>>> at
>>>> org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrate gy.java:249)
>>>>
>>>> at
>>>> org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.ja va:243)
>>>> at
>>>> org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrate gy.java:283)
>>>>
>>>> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
>>>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
>>>> at
>>>> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)
>>>> at
>>>> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)
>>>> at
>>>> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
>>>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
>>>> at
>>>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
>>>>
>>>> at
>>>> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>>>> at
>>>> org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
>>>> at
>>>> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>>>>
>>>> at
>>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>>>>
>>>> at
>>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>>>>
>>>> at
>>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>>>>
>>>> at
>>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>>>>
>>>> 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.core.launcher.Main.invokeFramework(Main.java:336 )
>>>> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
>>>> at org.eclipse.core.launcher.Main.run(Main.java:977)
>>>> at org.eclipse.core.launcher.Main.main(Main.java:952)
>>>>
>>>> I'm very appreciate to be contacted if you have some idea to solve
>>>> this problem, and very welcome to discuss similar problems.
>>>>
>>>> Thanks
>>>> Stefanie
>>>
Previous Topic:Selection decoration with XYLayoutEditPolicy in parent
Next Topic:Open Source Software Research
Goto Forum:
  


Current Time: Mon Sep 15 06:42:47 EDT 2025

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

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

Back to the top