I have a Stateless Session Bean (java ee 6, cdi) which throw events
@Stateless
public class CustomerService {
@Inject @ErrorMessage Event<BaseEvent> errMsg;
//[...]
public Customer getCustomer(String username, String password) {
Customer cust = null;
try {
//[...]
} catch (Exception ex) {
errMsg.fire(new BaseEvent("user not found [username="+username+"]"));
}
This bean is a part of a ejb-module. On the other hand I have two event observers which listen on those events. They look like
public void showErrorMessage(@Observes @ErrorMessage BaseEvent event) {
//do something with the event.
}
One observer is in the ejb-modul too. The other observer is in a war-module. The “ejb”-observer catch this call the other not.
If it is not possible to send an event from a ejb-module to a war-module?
Note: From the war-module to the ejb-module it is possible.
This might come down to whether classloader visibility from one module to the other is also assymetric. So if the WAR is not visible from classloader POV, the BeanManager in that WAR doesn’t think there is anyone else @observing it because he is not required to have scanned modules that are not visible.