Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 195546 - Running an IApplication from EclipseAppLauncher fails if thread=any
Summary: Running an IApplication from EclipseAppLauncher fails if thread=any
Status: CLOSED DUPLICATE of bug 193596
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Compendium (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: equinox.compendium-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-05 11:55 EDT by Alex Blewitt CLA
Modified: 2007-07-05 17:14 EDT (History)
1 user (show)

See Also:


Attachments
Provides a demo project to demonstrate the differences with thread=any/main (8.21 KB, text/plain)
2007-07-05 12:23 EDT, Alex Blewitt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Blewitt CLA 2007-07-05 11:55:15 EDT
When an IApplication extension point is specified as thread="any", it cannot be run from the launcher. If you attempt to run it, it gives an error message as below.

However, this is misleading. In fact, the application *does* run; as can be seen by the output to the Console. The framework, however, thinks that it hasn't started, and so kills the platform (which then shuts down the application). 

I've put together a test app with 3 example apps; they're all the same code (which prints out "Hello World", then "waiting" (sleep 1) "almost there" (sleep 1) "done".

I've also included the launch configurations for same; TestApp-any, Test-App-main and TestApp-default that have thread="any", thread="main" and one without thread. Running 'TestApp-any' shows the printout of the app starting, but gives the error message below, whilst default and main work successfully.

If thread=main, then aren't you limited to 1 instance of the app? It certainly seems to indicate that in the docs. If you want your app to play nicely and be fine with running outside of the main thread, then it seems you can't launch this from the command line.

java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:72)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
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:504)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
Comment 1 Alex Blewitt CLA 2007-07-05 12:23:52 EDT
Created attachment 73136 [details]
Provides a demo project to demonstrate the differences with thread=any/main

Run ThreadMain or ThreadDefault launches, and it works. Run ThreadAny, and whilst it's clear the application is launched, the framework doesn't think so and so shuts it down.
Comment 2 Thomas Watson CLA 2007-07-05 14:34:47 EDT
Alex, please try the patch in bug 193596.

*** This bug has been marked as a duplicate of bug 193596 ***
Comment 3 Alex Blewitt CLA 2007-07-05 17:14:18 EDT
Yeah, closing as dupe.