Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 5573 - ClassNotFoundException running snippet in debugger
Summary: ClassNotFoundException running snippet in debugger
Status: RESOLVED DUPLICATE of bug 1546
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 98
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Darin Wright CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-06 10:27 EST by Nick Edgar CLA
Modified: 2002-01-14 15:06 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2001-11-06 10:27:18 EST
Build 20011105 

- was debugging property page stuff
- traced into org.eclipse.ui.internal.PropertyPageContributionManager
(ObjectContributionManager).getContributors(Class)
- in stack frame, evaluated: lookup = null
- got the following in the console view:

java.lang.ClassNotFoundException: org.eclipse.ui.internal.CodeSnippet_1
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass
(DelegatingURLClassLoader.java:636)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:257)
	at java.lang.Class.forName1(Native Method)
	at java.lang.Class.forName(Class.java:134)
	at org.eclipse.ui.internal.ObjectContributorManager.getContributors
(ObjectContributorManager.java:100)
	at 
org.eclipse.ui.internal.dialogs.PropertyPageContributorManager.contribute
(PropertyPageContributorManager.java:51)
	at org.eclipse.ui.dialogs.PropertyDialogAction.run
(PropertyDialogAction.java:132)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:453)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:407)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent
(ActionContributionItem.java:361)
	at org.eclipse.jface.action.ActionContributionItem.access$0
(ActionContributionItem.java:352)
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent
(ActionContributionItem.java:47)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:727)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:710)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:820)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
	at org.eclipse.core.launcher.Main.run(Main.java:502)
	at org.eclipse.core.launcher.UIMain.main(UIMain.java:52)

- there was nothing in the .log
Comment 1 Darin Wright CLA 2001-11-06 14:05:02 EST
I was able to get the same evaluation (snippet) to work, in the same context 
(and "lookup" became null in the variables view, as expected). Problem is not 
specific to the test case provided.
Comment 2 Nick Edgar CLA 2001-11-06 15:54:40 EST
Did you try it on Win98?
Comment 3 Darin Wright CLA 2001-11-06 15:58:22 EST
I tried on Win2000. Will try on 98.
Comment 4 Nick Edgar CLA 2001-11-06 17:02:20 EST
Had a similar occurrence on Windows 2000, also with build 20011105.

My stack looked like:
Thread [main] (Suspended)
	Shell.setBounds(int, int, int, int, int) line: 668
	Shell(Control).setLocation(int, int) line: 1930
	VerifyDialog.openNewTestDialog() line: 253
	VerifyDialog.open(Dialog) line: 241
	DialogCheck.assertDialog(Dialog, Assert) line: 57
	UIMessageDialogs.testRefreshDeleteProject() line: 318
	Method.invoke(Object, Object[])
	UIMessageDialogs(TestCase).runTest() line: 166
	UIMessageDialogs(TestCase).runBare() line: 140
	TestResult$1.protect() line: 106
	TestResult.runProtected(Test, Protectable) line: 124
	TestResult.run(TestCase) line: 109
	UIMessageDialogs(TestCase).run(TestResult) line: 131
	TestSuite.runTest(Test, TestResult) line: 173
	TestSuite.run(TestResult) line: 168
	TestRunner(TestRunner).runTests(String[]) line: 268
	TestRunner(TestRunner).run() line: 176
	TestRunner.main(String[]) line: 22
	UITestApplication.runEventLoop() line: 31
	UITestApplication(Workbench).run(Object) line: 710
	InternalBootLoader.run(String, URL, String, String[]) line: 820
	BootLoader.run(String, URL, String, String[]) line: 285
	Method.invoke(Object, Object[])
	UIMain(Main).basicRun(String[]) line: 151
	UIMain(Main).run(String[]) line: 502
	UIMain.main(String[]) line: 52

In the frame for UIMessageDialogs.testRefreshDeleteProject(), I tried to 
evaluate: dialog.getShell().getSize().
I got the following stack trace in the console:

java.lang.ClassNotFoundException: org.eclipse.ui.tests.dialogs.CodeSnippet_1
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass
(DelegatingURLClassLoader.java:636)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:257)
	at java.lang.Class.forName1(Native Method)
	at java.lang.Class.forName(Class.java:134)
	at org.eclipse.swt.widgets.Shell.setBounds(Shell.java:668)
	at org.eclipse.swt.widgets.Control.setLocation(Control.java:1930)
	at org.eclipse.jdt.junit.internal.util.VerifyDialog.openNewTestDialog
(VerifyDialog.java:253)
	at org.eclipse.jdt.junit.internal.util.VerifyDialog.open
(VerifyDialog.java:241)
	at org.eclipse.jdt.junit.util.DialogCheck.assertDialog
(DialogCheck.java:57)
	at 
org.eclipse.ui.tests.dialogs.UIMessageDialogs.testRefreshDeleteProject
(UIMessageDialogs.java:318)
	at java.lang.reflect.Method.invoke(Native Method)
	at junit.framework.TestCase.runTest(TestCase.java:166)
	at junit.framework.TestCase.runBare(TestCase.java:140)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:131)
	at junit.framework.TestSuite.runTest(TestSuite.java:173)
	at junit.framework.TestSuite.run(TestSuite.java:168)
	at org.eclipse.jdt.junit.internal.TestRunner.runTests
(TestRunner.java:268)
	at org.eclipse.jdt.junit.internal.TestRunner.run(TestRunner.java:176)
	at org.eclipse.jdt.junit.eclipse.internal.TestRunner.main
(TestRunner.java:22)
	at org.eclipse.jdt.junit.eclipse.internal.UITestApplication.runEventLoop
(UITestApplication.java:31)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:710)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:820)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
	at org.eclipse.core.launcher.Main.run(Main.java:502)
	at org.eclipse.core.launcher.UIMain.main(UIMain.java:52)


Comment 5 Darin Wright CLA 2001-11-06 17:12:52 EST
I was able to reproduce this by doing an evaluation in a binary project, rather 
than a source project.
Comment 6 Darin Wright CLA 2001-11-06 17:17:54 EST
When using the "Eclipse Launcher" defined by com.oti.eclipsetools, the data for 
a binary project does not have a project folder in the "plugins" directory. 
Instead the data resides in a separate location, and is referenced on the 
classpath as an external jar. Thus, the plugin classloader cannot see the 
deployed class file (the plugin class loader looks for classes in the jars on 
the classpath and the "bin" directory of each project - but a "binary project" 
does not have a "bin" directory).

This will not work in the current implementation. Using an AST evaluation would 
solve the problem.
Comment 7 Philipe Mulet CLA 2001-11-07 07:49:45 EST
Can't you dump the file in a reserved location you always put on the classpath 
when launching in debug mode ? In the metadata area somewhere, not needed to be 
per project, just something global.
Comment 8 Darin Wright CLA 2001-11-07 09:26:49 EST
Putting a class file in a special place and adding it to the classpath does not 
work when a custom class loader is used. For example, the Eclipse class loader 
does not use the explicit classpath - it just looks in the "plugins" folders 
and "startup.jar".

NTOE: This solution would work for many programs that use a system class loader.
Comment 9 Darin Wright CLA 2002-01-14 15:06:07 EST
This requires AST evaluation feature. Not a bug. 

*** This bug has been marked as a duplicate of 1546 ***