|
|
|
|
|
|
|
|
|
|
Re: Problem with IEventBroker [message #749058 is a reply to message #740580] |
Tue, 25 October 2011 02:35 |
Brian de Alwis Messages: 242 Registered: July 2009 |
Senior Member |
|
|
As Tom alluded to earlier, you need to configure a Logger instance.
Basically, the implementor of IEventBroker is org.eclipse.e4.ui.services.internal.events.EventBroker, configured using DS through an IContextFunction. If you look at its definition, you'll see that it requires a org.eclipse.e4.core.services.log.Logger instance to be injected. But Logger is neither provided through DS using an IContextFunction, nor is it an OSGi service. Rather, it is defined by E4Application as it sets up the application's default context (see E4Application#createDefaultContext()).
Because a Logger instance cannot be found, and Logger is abstract (and hence can't be instantiated by the injection framework), the injection of EventBroker fails, and so the injection of your BundleInit fails too.
If you changed your code to something like the following
Bundle bundle = FrameworkUtil.getBundle(getClass());
BundleContext bundleContext = bundle.getBundleContext();
IEclipseContext eclipseCtx =
EclipseContextFactory.getServiceContext(bundleContext);
// configure the logger
eclipseCtx.set(Logger.class, null);
ContextInjectionFactory.make(helpers.BundleInit.class,eclipseCtx);
System.out.println("activate");
It would likely work (though you'll probably end up with an NPE from the null logger).
|
|
|
|
Re: Problem with IEventBroker [message #1691071 is a reply to message #753812] |
Thu, 02 April 2015 07:02 |
|
...not working here however.
Same identical task: I want to enable DI on a Java class instance I specify.
Same problem: Logger.
Curiously I could do this in plugin A but not on my new plugin B.
Plugin dependencies are just the same, what could be missing?
Caused by: org.eclipse.e4.core.di.InjectionException: Unable to process "EventBroker.logger": no actual value was found for the argument "Logger".
at org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:416)
at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:407)
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:109)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:337)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:258)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
at org.eclipse.e4.ui.services.events.EventBrokerFactory.compute(EventBrokerFactory.java:29)
at org.eclipse.e4.core.internal.contexts.ValueComputation.get(ValueComputation.java:61)
at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:246)
at org.eclipse.e4.core.internal.contexts.EclipseContext.get(EclipseContext.java:213)
at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:68)
at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:107)
at org.eclipse.e4.core.internal.contexts.EclipseContext.runAndTrack(EclipseContext.java:319)
at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier.get(ContextObjectSupplier.java:167)
at org.eclipse.e4.core.internal.di.InjectorImpl.resolveArgs(InjectorImpl.java:469)
at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:397)
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:109)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:337)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:258)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
at com.ebotlution.c4ids.drivers.xbee.lifecycle.Activator.start(Activator.java:52)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
thanks as always,
-Piero
|
|
|
|
Powered by
FUDForum. Page generated in 0.04521 seconds