Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Karl Weber is currently offline Karl WeberFriend
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 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
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 #800082 is a reply to message #799478] Thu, 16 February 2012 17:06 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

org.eclipse.e4.core.di.InjectionException: Unable to process "WorkbenchStatusReporter.shellProvider": no actual value was found for the argument "IShellProvider" was an issue in M5 and should be solved with https://bugs.eclipse.org/bugs/show_bug.cgi?id=370214.

I suggest you try the latest I-build.

Best regards, Lars

[Updated on: Thu, 16 February 2012 17:06]

Report message to a moderator

Re: Bug in org.eclipse.e4.core.di? [message #800254 is a reply to message #800082] Thu, 16 February 2012 21:36 Go to previous messageGo to next message
Karl Weber is currently offline Karl WeberFriend
Messages: 63
Registered: September 2010
Member
Lars Vogel wrote on Thu, 16 February 2012 18:06
org.eclipse.e4.core.di.InjectionException: Unable to process "WorkbenchStatusReporter.shellProvider": no actual value was found for the argument "IShellProvider" was an issue in M5 and should be solved with https://bugs.eclipse.org/bugs/show_bug.cgi?id=370214.

I suggest you try the latest I-build.

Best regards, Lars


Yes, but the bug you cited is not the problem. I tried the same with the platform as target, which is 4.2-I20120209. I got another exception showing explicitly, that the injection failed, see the attached screenshot. So the exception only provides better information now, but we learned nothing we didn't know before.

I will try to create a minimal example to reproduce the error and file a bug.


index.php/fa/7192/0/

[Updated on: Thu, 16 February 2012 21:42]

Report message to a moderator

Re: Bug in org.eclipse.e4.core.di? [message #800262 is a reply to message #800254] Thu, 16 February 2012 21:51 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

@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.
Re: Bug in org.eclipse.e4.core.di? [message #800267 is a reply to message #800254] Thu, 16 February 2012 22:00 Go to previous messageGo to next message
Karl Weber is currently offline Karl WeberFriend
Messages: 63
Registered: September 2010
Member
Sorry, I have to correct myself. One should think first and write later... The Configuration Admin does not seem to be part of the platform, so this injection must clearly fail.

However, once I make the injection of the Config Admin @Optional, no further problem occurs, which means, the injection of my test component works. Hence, the bug you cited seems to have indeed been the cause of my problem.

So I need a link to the I20120209 build for my target definition. Could you help me? Currently I am using http://download.eclipse.org/releases/juno

Furthermore I need the delta.pack. Can I use the delta.pack from 3.8M5 with 4.2-I20120209? Otherwise I would need another link...
Re: Bug in org.eclipse.e4.core.di? [message #800268 is a reply to message #800262] Thu, 16 February 2012 22:02 Go to previous messageGo to next message
Filipp A. is currently offline Filipp A.Friend
Messages: 49
Registered: February 2010
Member
@Karl: - put this code (enabled="true" immediate="true") in your component description (<scr:component ...), you can try to add servicefactory=true - and you DS bundle started automatically at osgi core start level
Re: Bug in org.eclipse.e4.core.di? [message #800269 is a reply to message #800267] Thu, 16 February 2012 22:03 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Sorry, don't know these links.

Maybe someone else?
Re: Bug in org.eclipse.e4.core.di? [message #800272 is a reply to message #800262] Thu, 16 February 2012 22:06 Go to previous messageGo to next message
Karl Weber is currently offline Karl WeberFriend
Messages: 63
Registered: September 2010
Member
Lars Vogel wrote on Thu, 16 February 2012 22: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.


I don't think so and this would indeed mean, that all components would have to be activated in advance -- so no lazy loading at all. This would really surprise me. My test component is indeed only registered but not activated, i.e. the Activate-method has not been called. It is activated at the moment I call the dialog, which should be the expected behaviour.
Re: Bug in org.eclipse.e4.core.di? [message #800276 is a reply to message #800268] Thu, 16 February 2012 22:10 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

@Karl: With @Optional you are telling the framework that null is ok. In this case the service is not required to be started. Otherwise I think it is.
Re: Bug in org.eclipse.e4.core.di? [message #800605 is a reply to message #800269] Fri, 17 February 2012 09:12 Go to previous messageGo to next message
Karl Weber is currently offline Karl WeberFriend
Messages: 63
Registered: September 2010
Member
Lars Vogel wrote on Thu, 16 February 2012 23:03
Sorry, don't know these links.


Just for the record, the link http://download.eclipse.org/eclipse/updates/4.2-I-builds seems to be what I need. It seems I can use this together with the delta.pack from 3.8M5 and the actual version of the config admin. At least I didn't get any problems so far.
Re: Bug in org.eclipse.e4.core.di? [message #801530 is a reply to message #800605] Sat, 18 February 2012 14:57 Go to previous message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 242
Registered: July 2009
Senior Member
Karl Weber wrote on Fri, 17 February 2012 04:12
]
Just for the record, the link http://download.eclipse.org/eclipse/updates/4.2-I-builds seems to be what I need. It seems I can use this together with the delta.pack from 3.8M5 and the actual version of the config admin. At least I didn't get any problems so far.


That's right. You can also get the delta pack (the launchers + SWT) from

http://download.eclipse.org/eclipse/updates/3.8-I-builds
Previous Topic:@Preference(value="data") as value for other Annotation
Next Topic:RCP can not say hello world
Goto Forum:
  


Current Time: Thu Mar 28 14:29:16 GMT 2024

Powered by FUDForum. Page generated in 0.07671 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top