Hello,
my problem concerns the following code
This ApplicationScoped Named Bean is accessed mainly from a Facelet using
JSF 2.0. It is ApplicationScoped becuase the data it holds is fairly small and is only very rarely updated. So whenever a "Status" is changed, I fire an Event<Status> from the class that changes it via a CRUD operation. When the StatusBackingBean is initially created and the @PostConstruct method is called, obviously the statusFacade (a StatelessSessionBean) in correctly injected and is not null. When the event fires when a "Status" object is changed, I want to reload all the statuses from the database, so that all users have a freshly updated list of Statuses. However when calling statusFacade.findAll(); in the method private void statusChanged(@Observes Status status) I get a NullPointerException stating that the StatusFacade is null.
Is it not true that in an ApplicationScoped Bean, injected Enterprise Beans should always have a reference to a valid instance. Why is it NULL when accessed for a second time when the statusChanged method is fired even though it is the same object every time? is the injected StatusFacade instance nulled right after the method annotated with "PostConstruct" returns?
I am using GlassFish 3 (with WELD), NetBeans 3.9.1