Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » InjectionException when attempting to send a map on event bus(InjectionException when attempting to send a map on event bus)
InjectionException when attempting to send a map on event bus [message #1173619] Wed, 06 November 2013 16:50 Go to next message
Joseph Gagnon is currently offline Joseph GagnonFriend
Messages: 58
Registered: June 2013
Member
I have a very simple eclipse4/JavaFX application and I'm testing out the use of the IEventBroker. My first attempt just sent a string and it was received by the subscriber as expected. Then I made a change to pass a Map instead of just a String. Now I get:

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-11-06 11:27:35.883
!MESSAGE Unable to create class 'my.app.ui.views.IncomingMessagesView' from bundle '51'
!STACK 0
org.eclipse.e4.core.di.InjectionException: Unable to process "IncomingMessagesView.model": no actual value was found for the argument "IncomoingMessagesModel".
	at org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:412)
	at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:403)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:108)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:333)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:254)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
	at org.eclipse.fx.ui.workbench.renderers.base.BasePartRenderer.doProcessContent(BasePartRenderer.java:87)
	at org.eclipse.fx.ui.workbench.renderers.base.BasePartRenderer.doProcessContent(BasePartRenderer.java:1)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.processContent(BaseRenderer.java:344)
	at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:150)
	at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:251)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.engineCreateWidget(BaseRenderer.java:307)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseStackRenderer$7.call(BaseStackRenderer.java:253)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseStackRenderer$7.call(BaseStackRenderer.java:1)
	at org.eclipse.fx.ui.workbench.renderers.fx.DefStackRenderer$StackItemImpl.handleSelection(DefStackRenderer.java:405)
	at org.eclipse.fx.ui.workbench.renderers.fx.DefStackRenderer$StackWidgetImpl$4.changed(DefStackRenderer.java:241)
	at org.eclipse.fx.ui.workbench.renderers.fx.DefStackRenderer$StackWidgetImpl$4.changed(DefStackRenderer.java:1)
	at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(Unknown Source)
	at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
	at javafx.beans.property.ReadOnlyObjectWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(Unknown Source)
	at javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(Unknown Source)
	at javafx.beans.property.ObjectPropertyBase.markInvalid(Unknown Source)
	at javafx.beans.property.ObjectPropertyBase.set(Unknown Source)
	at javafx.scene.control.SelectionModel.setSelectedItem(Unknown Source)
	at javafx.scene.control.TabPane$TabPaneSelectionModel.select(Unknown Source)
	at javafx.scene.control.SingleSelectionModel.selectFirst(Unknown Source)
	at javafx.scene.control.TabPane$TabPaneSelectionModel$1.onChanged(Unknown Source)
	at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(Unknown Source)
	at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(Unknown Source)
	at com.sun.javafx.collections.ObservableListWrapper.callObservers(Unknown Source)
	at com.sun.javafx.collections.ObservableListWrapper.addAll(Unknown Source)
	at com.sun.javafx.collections.ObservableListWrapper.addAll(Unknown Source)
	at org.eclipse.fx.ui.workbench.renderers.fx.DefStackRenderer$StackWidgetImpl.addItems(DefStackRenderer.java:303)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseStackRenderer.doProcessContent(BaseStackRenderer.java:225)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseStackRenderer.doProcessContent(BaseStackRenderer.java:1)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.processContent(BaseRenderer.java:344)
	at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:150)
	at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:251)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.engineCreateWidget(BaseRenderer.java:307)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseSashRenderer.doProcessContent(BaseSashRenderer.java:128)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseSashRenderer.doProcessContent(BaseSashRenderer.java:1)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.processContent(BaseRenderer.java:344)
	at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:150)
	at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:251)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.engineCreateWidget(BaseRenderer.java:307)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseSashRenderer.doProcessContent(BaseSashRenderer.java:128)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseSashRenderer.doProcessContent(BaseSashRenderer.java:1)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.processContent(BaseRenderer.java:344)
	at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:150)
	at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:251)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.engineCreateWidget(BaseRenderer.java:307)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseWindowRenderer.doProcessContent(BaseWindowRenderer.java:264)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseWindowRenderer.doProcessContent(BaseWindowRenderer.java:1)
	at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.processContent(BaseRenderer.java:344)
	at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:150)
	at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:251)
	at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.run(PartRenderingEngine.java:371)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
	at org.eclipse.fx.ui.workbench.fx.E4Application.jfxStart(E4Application.java:122)
	at org.eclipse.fx.osgi.util.AbstractJFXApplication$JFXApp.start(AbstractJFXApplication.java:45)
	at com.sun.javafx.application.LauncherImpl$5.run(Unknown Source)
	at com.sun.javafx.application.PlatformImpl$5.run(Unknown Source)
	at com.sun.javafx.application.PlatformImpl$4$1.run(Unknown Source)
	at com.sun.javafx.application.PlatformImpl$4$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl$4.run(Unknown Source)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source)
	at com.sun.glass.ui.win.WinApplication$3$1.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)


I'm curious what I'm doing wrong. The stack trace, unfortunately, doesn't help. Below are snippets from the two classes:

Sender class:

  public void sendText() {
    Map<String, Object> props = new HashMap<String, Object>();
    props.put(EventProperty.DATA, text.get());
    postEvent(EventTopic.SEND_DATA, props);
  }


BTW, postEvent() is implemented by an abstract superclass and is as follows:

  @Inject
  private IEventBroker eventBroker;

  protected void postEvent(String topic, Object payload) {
    eventBroker.post(topic, payload);
  }


Receiver class (IncomingMessagesView and IncommingMessagesModel):

  @Inject
  public void receiveData(@Optional @UIEventTopic(EventTopic.SEND_DATA) Map<String, Object> properties) {
    data.set((String) properties.get(EventProperty.DATA));
  }

[Updated on: Wed, 06 November 2013 16:53]

Report message to a moderator

Re: InjectionException when attempting to send a map on event bus [message #1173872 is a reply to message #1173619] Wed, 06 November 2013 20:18 Go to previous message
Joseph Gagnon is currently offline Joseph GagnonFriend
Messages: 58
Registered: June 2013
Member
Update: Although I couldn't really find any documentation to confirm or deny, I stumbled upon a way to make this work. On the sending side, I can pass my map of properties in the IEventBroker.post() (or .send()) call. On the receiving side, instead of trying to receive the map of properties, I need to receive an object of type org.osgi.service.event.Event. This does not blow up and lo and behold when I inspect the object, it contains the topic string and my properties map.
Previous Topic:How to refresh/ redraw MPart
Next Topic:PartSashContainer inside Part
Goto Forum:
  


Current Time: Thu Nov 20 22:54:27 GMT 2014

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

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