I have two SLSBs:
BeanF,BeanO
in two ejb-jars:
ModF,ModO.
BeanF fires an event and BeanO observes it.
The first fire(-) operation ends with the exception (Wildfly 8.2):
ERROR [org.jboss.as.ejb3.invocation] JBAS014134: EJB Invocation failed on component BeanF for method public void BeanF.publish(ModEvent):
javax.ejb.EJBException: org.jboss.msc.service.ServiceNotFoundException: Service service
jboss.deployment.subunit."myapp.ear"."modO.jar".component.BeanO.VIEW."BeanO".LOCAL not found
Further fire(-) operations reach the observer but I can't let any event to be lost.
Is there a way to force the initialization of the observer before the event is fired (or on the fly after the event is fired and awaits processing)?
The @Observes(notifyObserver = Reception.IF_EXISTS) only allows the event to be skipped silently when the observer is not ready yet.
In my case the BeanF cannot be dependent on BeanO because ModO must be declared after ModF in the application.xml.
Is it possible with CDI events/listeners or would I need to go with JMS?
First of all, I think that CDI creates a 'new' instance of the bean and delivers the event to it in case
I wrote about this here
So this behavior is strange IMO
In terms of alternatives - is it possible to declare you observer method as 'static' ? CDI will certainly invoke it in that case
Also, if you haven't already, I would strongly suggest reading the CDI spec doc (ch 10 and section 5.5.6)