Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 171820 - Something's wrong with the JUnit Plug-in Test launcher
Summary: Something's wrong with the JUnit Plug-in Test launcher
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.3 M5   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-26 11:37 EST by Markus Keller CLA
Modified: 2007-01-30 04:19 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2007-01-26 11:37:03 EST
I20070123-1715

With the latest I-build, I often cannot launch PDE JUnit Plug-in Tests (e.g. PullUpTests from org.eclipse.jdt.ui.tests.refactoring. I don't have steps to reproduce reliably.

The problem is that PDE launches with
-application org.eclipse.pde.junit.runtime.coretestapplication
instead of 
-application org.eclipse.pde.junit.runtime.uitestapplication

I have had the wrong coretestapplication in one launch, then removed the launch configuration and started again with 'Debug As > JUnit Plug-in Tests' and then got the uitestapplication (all in one session, autobuild on, no compile errors).


With the coretestapplication, the first access to a UI plug-in fails, e.g:

osgi> !SESSION 2007-01-26 17:24:28.889 -----------------------------------------------
eclipse.buildId=I20070123-1715
java.version=1.5.0_10
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_CH
Framework arguments:  -showlocation -version 3 -port 2439 -testLoaderClass org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader -loaderpluginname org.eclipse.jdt.junit.runtime -classNames org.eclipse.jdt.ui.tests.refactoring.PullUpTests -application org.eclipse.pde.junit.runtime.coretestapplication -product org.eclipse.sdk.ide -pdelaunch -showlocation -testpluginname org.eclipse.jdt.ui.tests.refactoring
Command-line arguments:  -clean -console -consolelog -showlocation -version 3 -port 2439 -testLoaderClass org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader -loaderpluginname org.eclipse.jdt.junit.runtime -classNames org.eclipse.jdt.ui.tests.refactoring.PullUpTests -application org.eclipse.pde.junit.runtime.coretestapplication -product org.eclipse.sdk.ide -data C:\e\i\I20070123-1715-clean\a/../junit-workspace -dev file:C:/e/i/I20070123-1715-clean/a/.metadata/.plugins/org.eclipse.pde.core/pde-junit/dev.properties -pdelaunch -clean -console -consolelog -showlocation -os win32 -ws win32 -arch x86 -testpluginname org.eclipse.jdt.ui.tests.refactoring

!ENTRY org.eclipse.osgi 2 0 2007-01-26 17:24:31.406
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2007-01-26 17:24:31.406
!MESSAGE Bundle update@plugins/org.eclipse.jdt.compiler.tool_1.0.0.v_728.jar [48] was not resolved.
!SUBENTRY 2 org.eclipse.jdt.compiler.tool 2 0 2007-01-26 17:24:31.406
!MESSAGE Missing Constraint: Bundle-RequiredExecutionEnvironment: JavaSE-1.6

!ENTRY org.eclipse.osgi 4 0 2007-01-26 17:24:33.876
!MESSAGE An error occurred while automatically activating bundle org.eclipse.jdt.ui (60).
!STACK 0
org.osgi.framework.BundleException: Exception in org.eclipse.jdt.internal.ui.JavaPlugin.start() of bundle org.eclipse.jdt.ui.
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1018)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:336)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400)
	at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:417)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:189)
	at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:340)
	at org.eclipse.osgi.framework.internal.core.SingleSourcePackage.loadClass(SingleSourcePackage.java:37)
	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:405)
	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:369)
	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:357)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
	at java.lang.Class.getMethod0(Class.java:2642)
	at java.lang.Class.getMethod(Class.java:1579)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:99)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58)
	at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethod(EclipseAppContainer.java:522)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:147)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:170)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:476)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:416)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1124)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1099)
Caused by: java.lang.IllegalStateException: Workbench has not been created yet.
	at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:92)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.install(ASTProvider.java:287)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.<init>(ASTProvider.java:278)
	at org.eclipse.jdt.internal.ui.JavaPlugin.getASTProvider(JavaPlugin.java:638)
	at org.eclipse.jdt.internal.ui.JavaPlugin.start(JavaPlugin.java:349)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993)
	... 44 more
Root exception:
java.lang.IllegalStateException: Workbench has not been created yet.
	at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:92)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.install(ASTProvider.java:287)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.<init>(ASTProvider.java:278)
	at org.eclipse.jdt.internal.ui.JavaPlugin.getASTProvider(JavaPlugin.java:638)
	at org.eclipse.jdt.internal.ui.JavaPlugin.start(JavaPlugin.java:349)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:336)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400)
	at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:417)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:189)
	at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:340)
	at org.eclipse.osgi.framework.internal.core.SingleSourcePackage.loadClass(SingleSourcePackage.java:37)
	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:405)
	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:369)
	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:357)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
	at java.lang.Class.getMethod0(Class.java:2642)
	at java.lang.Class.getMethod(Class.java:1579)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:99)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58)
	at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethod(EclipseAppContainer.java:522)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:147)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:170)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:476)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:416)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1124)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1099)

!ENTRY org.eclipse.equinox.app 4 0 2007-01-26 17:24:33.892
!MESSAGE Error in invoking method.
!STACK 0
java.lang.NoClassDefFoundError: org/eclipse/jdt/internal/corext/refactoring/structure/PullUpRefactoring
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
	at java.lang.Class.getMethod0(Class.java:2642)
	at java.lang.Class.getMethod(Class.java:1579)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:99)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58)
	at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethod(EclipseAppContainer.java:522)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:147)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:170)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:476)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:416)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1124)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1099)
Comment 1 Dani Megert CLA 2007-01-26 11:45:16 EST
I saw the same. Strangely it worked again and then was broken again.
Comment 2 Wassim Melhem CLA 2007-01-26 13:03:02 EST
Interesting because PDE did not contribute code to that build due to the eclipse.org server crash.  So I am not sure how we could have gotten broken.
Comment 3 Markus Keller CLA 2007-01-26 13:13:22 EST
I'm not sure it's new in I20070123-1715, could also have happened in the previous I-build (I did not run tests very often in the last week). OTOH, it could also be a problem with equinox resolving wrong bundles.
Comment 4 Dani Megert CLA 2007-01-28 13:13:56 EST
I noticed this two weeks ago but didn't file a bug because it was not constantly reproducible and I could not get a pattern for a test case.
Comment 5 Markus Keller CLA 2007-01-29 08:34:18 EST
The bug depends on the way you create the launch configuration.

If you create the launch config via "Context Menu > Run As > JUnit Plug-in Test", then it works.

If you create the launch config via "Run > Debug..." and then doubleclick "JUnit Plug-in Test", then the wrong "-application org.eclipse.pde.junit.runtime.coretestapplication" is used.

Steps to reproduce in I20070123-1715:
- new plug-in project
- add Require-Bundle: org.junit, org.eclipse.ui.workbench
- use this test class:

package tests;

import junit.framework.TestCase;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

public class SampleTest extends TestCase {
	public void test1() throws Exception {
		IWorkbench workbench = PlatformUI.getWorkbench();
		assertNotNull(workbench);
	}
}
Comment 6 Markus Keller CLA 2007-01-29 09:54:23 EST
Note that this also affects old launch configurations:
- steps from comment 5 in M4 (launch from context menu)
- load same workspace in I20070123-1715
- "Run > Debug..."
- select old launch config
- go to Main tab
- click Debug
=> Boom!

Just be going to the Main tab, the launch configuration got a persistent attribute
<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
Comment 7 Wassim Melhem CLA 2007-01-30 02:57:07 EST
yes, there is certainly a problem here.  working on it.
Comment 8 Wassim Melhem CLA 2007-01-30 03:19:41 EST
The problem is that the default application for the workbench has been renamed recently from 'org.eclipse.ui.ide.workbench' to 'org.eclipse.ui.ide.app.workbench', and we were not notified.

Since the config.ini in the eclipse installation does not list a value for eclipse.application, PDE falls back on a hardcoded default (org.eclipse.ui.ide.workbench).  This value needs to be updated now and we need to have backward compatibility for the old app.
Comment 9 Wassim Melhem CLA 2007-01-30 03:45:11 EST
Fixed.  Also updated the javadoc for TargetPlatform#getDefaultApplication().

will be in the I-build.
Comment 10 Markus Keller CLA 2007-01-30 04:19:02 EST
> will be in the I-build.
Thanks a lot, makes my life much easier!

I had a gut feeling that the change to 'org.eclipse.ui.ide.app.workbench' will lead to trouble, but unfortunately I didn't insist on reverting that change as soon as I became aware of it...