Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 74663

Summary: Error when running tests with missing plugins does not provide enough info
Product: [Eclipse Project] PDE Reporter: Nick Edgar <n.a.edgar>
Component: UIAssignee: PDE-UI-Inbox <pde-ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse, markus.kell.r, wassim.melhem
Version: 3.0   
Target Milestone: 3.2 M3   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Nick Edgar CLA 2004-09-22 14:09:30 EDT
build I20040921-2000

- UI and UI tests loaded from repository
- ran one of our test suites, but with the launch config changed to use the PDE
Target's plugins instead of the workspace's, except for org.eclipse.ui.tests
- got the following in the console:
"Error:  " java.lang.IllegalArgumentException: No ClassLoader found for
testplugin: org.eclipse.ui.tests

I assume this was due to me missing a prerequisite in the set of chosen plugins: 
org.eclipse.test.performance.

However, there was nothing in the target workspace's log, nor in the PDE
metadata area for the config, to help me track this down further.
Comment 1 Nick Edgar CLA 2004-09-22 14:12:46 EDT
Note: I sometimes run tests in this way in order to test against the build
rather than the code loaded from CVS.

Adding org.eclipse.test.performance to the set of plugins fixed up the problem.
Comment 2 Wassim Melhem CLA 2004-09-22 23:27:04 EDT
At startup, all we (the test runner) know is that the plugin containing the 
tests is not found in the registry.  We can't provide any analysis, so all we 
can do here is improve the message to tell you that "the plugin containing the 
tests is either misssing or has been disabled due to a missing dependency."

Incidentally, I hope you used the "Validate Plug-in Set" button on the Plugins 
tab of the launcher to figure out that org.eclipse.test.performance was 
missing ;-)

Comment 3 Nick Edgar CLA 2004-09-23 09:46:21 EDT
Should this be moved to runtime, then?  I was just wondering if there was
somewhere else I should look for a log file.

The Validate button is nice.  But since the set of plugins in a launch config
can change by adding/removing projects from the workspace, would it not be
better to check when launching?
Comment 4 Wassim Melhem CLA 2004-09-23 09:50:42 EDT
Upon re-reading your report, I am surprised that you did not find anything in 
the log.  I think, once upon a time, disabled plug-ins used to be reported in 
the log.  In any event, I will improve the message on the PDE side, but this 
is really a runtime issue, since by the time the PDE/JUnit applications gets 
invoked, the registry had been built.
Comment 5 Wassim Melhem CLA 2004-09-23 10:04:53 EDT
>But since the set of plugins in a launch configcan change by adding/removing 
>projects from the workspace, would it not be better to check when launching?

The button will just give you a preview of any imminent disaster.  It is a 
relatively costly operation and thus is only done on demand.

If we were to do a gratuitous check at the time of the launch, it will be 
duplicating what the runtime is doing.
Comment 6 Nick Edgar CLA 2004-09-23 10:12:45 EDT
As long as the log is visible ;-).
Comment 7 Rafael Chaves CLA 2004-09-23 10:17:12 EDT
We only check and log unresolved plug-ins if in debug mode (see bug 62118).
Comment 8 Rafael Chaves CLA 2004-09-23 10:22:56 EDT
And since the instance location does not get set (we fail too early), the log
would be in the configuration area (inside org.eclipse.pde.core's state location).
Comment 9 Nick Edgar CLA 2004-09-23 10:49:20 EDT
I was running it under the debugger, and did not see anything in the PDE core
metadata area either.
Comment 10 Rafael Chaves CLA 2004-09-23 11:42:40 EDT
Sorry, I meant running with -debug or tracing enabled (and this is an exclusive or).
Comment 11 Nick Edgar CLA 2004-09-23 15:10:59 EDT
OK, I added -debug to the command line.
The log now (in the workspace dir, not the PDE metadata area) has:

!SESSION Sep 23, 2004 14:58:26.866 ---------------------------------------------
eclipse.buildId=unknown
java.fullversion=J2RE 1.4.2 IBM Windows 32 build cn142-20040917 (JIT disabled)
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -version 3 -application
org.eclipse.pde.junit.runtime.uitestapplication -pdelaunch -port 3337
-testpluginname org.eclipse.ui.tests -classnames
org.eclipse.ui.tests.multipageeditor.MultiPageEditorTestSuite

!ENTRY org.eclipse.osgi Sep 23, 2004 14:58:26.876
!MESSAGE Bundle update@/d:/eclipse-new/plugins/org.eclipse.ui.tests/ [88] was
not resolved.
!SUBENTRY 1 org.eclipse.osgi Sep 23, 2004 14:58:26.876
!MESSAGE Missing required bundle org.eclipse.test.performance_0.0.0.


So this is more helpful.  However, I thought PDE tried to tell the user about
any log file created.  It didn't in this case.  Or is that only if there's a
certain exit code?  If so, then it looks like uitestapplication is not returning
the right error code.


Comment 12 Wassim Melhem CLA 2004-09-23 15:32:28 EDT
The PDE launcher listener prompts you to see the log (if available) when the 
exit code of the launch is abnormal.

uitestapplication is certainly guilty of not returning an appropriate exit 
code, but even if it did, the runtime, as I just read, does not log 
unsatisfied dependencies unless in -debug mode, so the log file would not be 
there in normal circumstances, and PDE could not let you know anything.
Comment 13 Rafael Chaves CLA 2004-09-23 15:50:02 EDT
That means you are going to move this bug to your bucket and change the
applications provided by PDE Junit to return a non-zero exit code when no tests
are run? <g>
Comment 14 Wassim Melhem CLA 2004-09-23 15:52:41 EDT
I'll move to my bucket, but I don't know how Nick would be better off in any 
way, if he doesn't use -debug and hence no log would be found.
Comment 15 Nick Edgar CLA 2004-09-23 16:00:28 EDT
Maybe your error message could suggest running with -debug <g>.
Comment 16 Wassim Melhem CLA 2004-09-23 16:05:07 EDT
With what I know now, your idea from comment 3 to do automatic validation upon 
launching (as an option perhaps) is starting to look a lot more attractive now.
Comment 17 Rafael Chaves CLA 2004-09-23 16:06:07 EDT
Regardless you add validation to the launch configuration UI, I think that
instead of just returning an arbitrary exit code, org.eclipse.pde.junit.runtime
should throw an exception to the caller (instead of writing to the console. 

Then Core could take care of logging any unresolved bundles (if it has not done
that yet) in case that happens.
Comment 18 Rafael Chaves CLA 2004-10-05 11:36:38 EDT
*** Bug 75648 has been marked as a duplicate of this bug. ***
Comment 19 Wassim Melhem CLA 2004-10-05 13:34:40 EDT
Rafael, although it's along the same theme, I don't think bug 75618 is a 
duplicate of this bug, since whatever I do here will not help Markus.

The problem is that the runtime does not log error messages as to why plugins 
are disabled unless you pass the -debug flag.  Errors of such nature are 
serious enough to be logged by the runtime whether or not you're not in debug 
mode; otherwise, the user (includig this seasoned Swiss user) is left puzzled 
as to why his plugins are not showing up.

In his case, the runtime Eclipse came up (i.e. the launch did not abort with 
some error code). He is therefore left wondering why oh why his plugin did not 
show up.

I therefore suggest the runtime team reexamine their position on when to log 
unsatisfied dependencies.
Comment 20 Nick Edgar CLA 2004-10-05 13:46:52 EDT
I would have to agree.  Judging by posts in the eclipse.platform.rcp newsgroup,
almost everybody hits this problem when first trying to deploy their RCP app
(they generally have less problems when running from PDE).  

While Wassimm's much-anticipated RCP app deployment wizard will help with this
(not to mention the Validate Plugins button in the PDE launcher), it would be
nice if runtime was more self-explanatory when something went wrong.  

If the cost of doing the dependency analysis is expensive, would it be possible
to just set a flag if any plug-ins get disabled due to unresolved prerequisites,
and then only do the full dump if the flag is set?
Comment 21 Rafael Chaves CLA 2004-10-05 14:07:13 EDT
I reopened bug 75618.
Comment 22 Nick Edgar CLA 2004-10-05 14:28:06 EDT
Wassim, when I launch an Eclipse Application, I am getting any problems with
dependencies dumped to the log even though I don't have -debug on the command
line.  For example, if I uncheck org.eclipse.jface from the browser example's
launch config, I get:

!SESSION Oct 05, 2004 14:12:49.527 ---------------------------------------------
eclipse.buildId=unknown
java.fullversion=J2RE 1.4.2 IBM J9 2.2 Windows 2000 x86-32 j9n142-20040917 (JIT
enabled)
J9VM - 20040916_0908_lHdSMR
JIT  - r7_level20040915_1801
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -product org.eclipse.ui.examples.rcp.browser.product
-pdelaunch -url d:\web\eclipsecon home.htm 

!ENTRY org.eclipse.core.runtime Oct 05, 2004 14:12:49.537
!MESSAGE Product org.eclipse.ui.examples.rcp.browser.product could not be found.

!ENTRY org.eclipse.osgi Oct 05, 2004 14:12:49.557
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: No application id has been found.
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:313)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
	at java.lang.reflect.Method.invoke(Method.java:391)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
	at org.eclipse.core.launcher.Main.run(Main.java:704)
	at org.eclipse.core.launcher.Main.main(Main.java:688)

!ENTRY org.eclipse.osgi Oct 05, 2004 14:12:49.567
!MESSAGE Bundle initial@reference:file:d:/eclipse-new/plugins/org.eclipse.ui/
[6] was not resolved.
!SUBENTRY 1 org.eclipse.osgi Oct 05, 2004 14:12:49.567
!MESSAGE Missing required bundle org.eclipse.jface_0.0.0.
!SUBENTRY 1 org.eclipse.osgi Oct 05, 2004 14:12:49.567
!MESSAGE Missing required bundle org.eclipse.ui.workbench_0.0.0.

!ENTRY org.eclipse.osgi Oct 05, 2004 14:12:49.577
!MESSAGE Bundle
initial@reference:file:d:/eclipse-new/plugins/org.eclipse.ui.examples.rcp.browser/
[7] was not resolved.
!SUBENTRY 1 org.eclipse.osgi Oct 05, 2004 14:12:49.597
!MESSAGE Missing required bundle org.eclipse.ui_0.0.0.

!ENTRY org.eclipse.osgi Oct 05, 2004 14:12:49.597
!MESSAGE Bundle
initial@reference:file:d:/eclipse-new/plugins/org.eclipse.ui.workbench/ [8] was
not resolved.
!SUBENTRY 1 org.eclipse.osgi Oct 05, 2004 14:12:49.597
!MESSAGE Missing required bundle org.eclipse.jface_0.0.0.


How is this happening?  Does -pdelaunch imply -debug?
Comment 23 Wassim Melhem CLA 2004-10-05 16:24:24 EDT
Interesting.  You have to ask the runtime guys about that.

-pdelaunch is unrelated though.  the -pdelaunch arg is an internal arg only 
used by PDE to distinguish between a dev app and a runtime app.  It affects 
the way we read the target platform.
Comment 24 Nick Edgar CLA 2004-10-05 16:40:36 EDT
Rafael, can you comment on comment #22?
Comment 25 Rafael Chaves CLA 2004-10-05 16:42:35 EDT
Are you sure you haven't enabled tracing in the launch configuration?
Comment 26 Nick Edgar CLA 2004-10-05 16:43:23 EDT
Yes.  Tracing is not on.
Comment 27 Rafael Chaves CLA 2004-10-05 16:49:08 EDT
Ok, this goes back to the point I made before (comment 17). If something really
bad happens (the application cannot start, or exits with an exception), we log
any unresolved bundles (bug 63858).
Comment 28 Nick Edgar CLA 2004-10-05 17:09:10 EDT
OK, thanks, that explains it.  I actually get the same behaviour when running a
deployed example (not via PDE).
Comment 29 Wassim Melhem CLA 2004-10-05 17:11:41 EDT
>I actually get the same behaviour when running adeployed example (not via 
>PDE).
Mission accomplished for PDE :-)
Comment 30 Wassim Melhem CLA 2005-10-30 01:11:51 EST
PDE now gives you the option (a checkbox) on the Plugins tab of the launch 
config to do an automatic plugin dependency analysis prior to launching.