Home » Eclipse Projects » Eclipse 4 » Bug in org.eclipse.e4.core.di?
Bug in org.eclipse.e4.core.di? [message #799464] |
Wed, 15 February 2012 23:22 |
Karl Weber Messages: 63 Registered: September 2010 |
Member |
|
|
I first posted this question in the equinox forum, but now I suspect it may be a bug in e4.
I get the following exception
org.eclipse.e4.core.di.InjectionException: Unable to process "WorkbenchStatusReporter.shellProvider": no actual value was found for the argument "IShellProvider".
The problem can be traced down to the following piece of code
@Inject
private ConfigurationAdmin fConfigAdmin;
that is located in a dialog DBLocationDialog, which is opened through a menu-handler, as given here
public class DBLocationHandler {
@Execute
public void execute(IEclipseContext context) {
DBLocationDialog dialog = ContextInjectionFactory.make(DBLocationDialog.class, context);
dialog.open();
}
}
As written in my post cited above, the problem only occurs, when the configuration admin bundle is started with default startlevel and default auto-start. When that bundle is started with auto-start true, the exception is not thrown, i.e. the injection in the dialog succeeds.
Now I get the same exception with a test component of mine. The code causing the exception is again
@Inject
private ITest fTest;
The interface is implemented through a lazily activating component. At first, the service ITest is not used, as shown in the osgi console
{de.trm.app.ITest}={component.name=de.trm.app.Component, component.id=9, service.id=43}
"Registered by bundle:" de.trm.app_1.0.0.qualifier [53]
"No bundles using service."
The component is not activated yet. When the same dialog is called through the same menu-handler, the same exception occurs, but the component is activated right before:
osgi> $$$ COMPONENT STARTING
org.eclipse.e4.core.di.InjectionException: Unable to process "WorkbenchStatusReporter.shellProvider": no actual value was found for the argument "IShellProvider".
The text "$$$ COMPONENT STARTING" is written to System.out in the Activate-method of the test component. Now the osgi console says
{de.trm.app.ITest}={component.name=de.trm.app.Component, component.id=9, service.id=43}
"Registered by bundle:" de.trm.app_1.0.0.qualifier [53]
"Bundles using service"
org.eclipse.e4.ui.workbench_0.10.1.v20120126-1604 [48]
Since e4 is now using this component, why fails the injection of ITest? To me it looks as if it is a bug in e4.
Well, I am using 4.2M5 as Target.
|
|
|
Re: Bug in org.eclipse.e4.core.di? [message #799478 is a reply to message #799464] |
Wed, 15 February 2012 23:48 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Please file a bug with a reproduceable testcase.
Tom
Am 16.02.12 00:22, schrieb Karl Weber:
> I first posted this http://www.eclipse.org/forums/index.php/t/289108/ in
> the equinox forum, but now I suspect it may be a bug in e4.
>
> I get the following exception
>
>
> org.eclipse.e4.core.di.InjectionException: Unable to process
> "WorkbenchStatusReporter.shellProvider": no actual value was found for
> the argument "IShellProvider".
>
> The problem can be traced down to the following piece of code
>
>
> @Inject
> private ConfigurationAdmin fConfigAdmin;
>
> that is located in a dialog DBLocationDialog, which is opened through a
> menu-handler, as given here
>
>
> public class DBLocationHandler {
>
> @Execute
> public void execute(IEclipseContext context) {
> DBLocationDialog dialog =
> ContextInjectionFactory.make(DBLocationDialog.class, context);
> dialog.open();
> }
>
> }
>
> As written in my post cited above, the problem only occurs, when the
> configuration admin bundle is started with default startlevel and
> default auto-start. When that bundle is started with auto-start true,
> the exception is not thrown, i.e. the injection in the dialog succeeds.
>
> Now I get the same exception with a test component of mine. The code
> causing the exception is again
>
>
> @Inject
> private ITest fTest;
>
> The interface is implemented through a lazily activating component. At
> first, the service ITest is not used, as shown in the osgi console
>
>
> {de.trm.app.ITest}={component.name=de.trm.app.Component, component.id=9,
> service.id=43}
> "Registered by bundle:" de.trm.app_1.0.0.qualifier [53]
> "No bundles using service."
>
> The component is not activated yet. When the same dialog is called
> through the same menu-handler, the same exception occurs, but the
> component is activated right before:
>
>
> osgi> $$$ COMPONENT STARTING
> org.eclipse.e4.core.di.InjectionException: Unable to process
> "WorkbenchStatusReporter.shellProvider": no actual value was found for
> the argument "IShellProvider".
>
> The text "$$$ COMPONENT STARTING" is written to System.out in the
> Activate-method of the test component. Now the osgi console says
>
>
> {de.trm.app.ITest}={component.name=de.trm.app.Component, component.id=9,
> service.id=43}
> "Registered by bundle:" de.trm.app_1.0.0.qualifier [53]
> "Bundles using service"
> org.eclipse.e4.ui.workbench_0.10.1.v20120126-1604 [48]
>
> Since e4 is now using this component, why fails the injection of ITest?
> To me it looks as if it is a bug in e4.
>
> Well, I am using 4.2M5 as Target.
|
|
| | |
Re: Bug in org.eclipse.e4.core.di? [message #800262 is a reply to message #800254] |
Thu, 16 February 2012 21:51 |
|
@Karl: yes this error was masking other errors, I thought that was your complained.
From what I can see, the current behavior of Eclipse is correct for your example. The bundle which declares a service must be activated before DI tries to inject it. Otherwise its not yet available and an error message is thrown.
As far as I know bundles which define services must be activated before there injection.
|
|
| | | | | | | |
Goto Forum:
Current Time: Thu Mar 28 14:29:16 GMT 2024
Powered by FUDForum. Page generated in 0.07671 seconds
|